Skip to content

Instantly share code, notes, and snippets.

@xlplugins
Last active April 16, 2018 07:42
Show Gist options
  • Save xlplugins/928daa26788cadce6f29d8f9a024a22e to your computer and use it in GitHub Desktop.
Save xlplugins/928daa26788cadce6f29d8f9a024a22e to your computer and use it in GitHub Desktop.
Sales Trigger: Add more WC States to Sales Count or Sales Snippet triggers data fetching.
<?php
/**
* Add your custom order statuses to sales snippet or count triggers
*/
if ( ! function_exists( 'theme_modify_wcst_custom_wc_order_states' ) ) {
add_filter( 'wcst_modify_wc_order_states', 'theme_modify_wcst_custom_wc_order_states', 90 );
/**
* Hooked into `wcst_modify_wc_order_states`
*
* @param $states Existing WC Order States
*
* @return mixed
*/
function theme_modify_wcst_custom_wc_order_states( $states ) {
/** Already included order states: "wc-processing", "wc-on-hold" & "wc-completed" */
/** If you want to include 'pending' order state */
array_push( $states, 'wc-pending' );
/** add array_push multiple times if you want to include multiple order status */
return $states;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment