Woocommerce Report Tokens

Am I the only who thinks there’s a serious shortage of Woocommerce report tokens? In the documentation, here are the only ones available:

[wcomstatus.sales] – Displays total sales during the selected data range
[wcomstatus.topseller] – Displays the top seller product during the selected data range
[wcomstatus.awaitingprocessing] – Displays the number of products currently awaiting for processing
[wcomstatus.onhold] – Displays the number of orders currently on hold
[wcomstatus.lowonstock] – Displays the number of products currently low on stock
[wcomstatus.outofstock] – Displays the number of products currently out of stock

Are these really the only available ones? Is there a documentation somewhere that I can check on how to create custom ones?

To those who include Woocommerce data in client reports, how do you send data with no shortcodes available?

Hi @gslwebsol,

thanks for reaching out.
Yes, at the moment, this is the complete list of Woocommerce data available in reports.
Basically, this is data that is supported through the MainWP WooCommerce Status Extension.

If you are looking into creating custom Report tokens, here are available hooks

// Create Custom Pro Report tokens
add_filter( 'mainwp_pro_reports_tokens_groups', 'mycustom_reports_tokens_groups' );
function mycustom_reports_tokens_groups( $tokens ) {
       // examples
       $tokens['plugins']['sections'][] = array( 'name' => 'section.plugins.custompluginsection', 'desc' => 'Custom plugin section descriptions' );
       $tokens['plugins']['nav_group_tokens']['custompluginsection'] = 'Custom plugin section';
       $tokens['custompluginsection'][] = array( 'name' => 'plugin.custompluginsection.tokenname1', 'desc' => 'Token1 name descriptions' );
       $tokens['custompluginsection'][] = array( 'name' => 'plugin.custompluginsection.tokenname2', 'desc' => 'Token2 name descriptions' );
       return $tokens;

}

// token values
add_filter('mainwp_pro_reports_custom_tokens', 'mycustom_reports_custom_tokens');
function mycustom_reports_custom_tokens($tokens_values, $report) {
       $tokens_values['[plugin.custompluginsection.tokenname1]'] = 'Value for custom token name1';
       $tokens_values['[plugin.custompluginsection.tokenname2]'] = 'Value for custom token name2';
       return $tokens_values;
}
2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.