Skip to content

Instantly share code, notes, and snippets.

@jessepearson
Last active December 2, 2019 18:53
Show Gist options
  • Select an option

  • Save jessepearson/5b1cb1192488a2b4421bd214ccf17d45 to your computer and use it in GitHub Desktop.

Select an option

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.
<?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