Last active
December 2, 2019 18:53
-
-
Save jessepearson/5b1cb1192488a2b4421bd214ccf17d45 to your computer and use it in GitHub Desktop.
Simple filter to add the 'partial-payment' status from Deposits to the order statuses that get pulled into default WooCommerce reports.
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 // do not copy this line | |
| /** | |
| * Simple filter to add the 'partial-payment' status to the order statuses that get pulled into | |
| * default WooCommerce reports. | |
| * | |
| * @param arr $statuses The original statuses. | |
| * @return arr The updated statuses. | |
| * @link https://gist.github.com/jessepearson/5b1cb1192488a2b4421bd214ccf17d45 | |
| */ | |
| function jp_woocommerce_reports_order_statuses_filter( $statuses ) { | |
| // If we have an array and 'completed' is in it, we want to add 'partial-payment' as well. | |
| if ( is_array( $statuses ) && in_array( 'completed', $statuses ) ) { | |
| $statuses[] = 'partial-payment'; | |
| } | |
| return $statuses; | |
| } | |
| add_filter( 'woocommerce_reports_order_statuses', 'jp_woocommerce_reports_order_statuses_filter', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment