Last active
April 16, 2018 07:42
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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