Created
January 6, 2016 00:56
-
-
Save tamarazuk/1bde8adecb05934e967a to your computer and use it in GitHub Desktop.
WooCommerce Customer/Order CSV Export - Auto-export only orders with subscriptions or renewals
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 // only copy this line if needed | |
function sv_wc_customer_order_csv_auto_export_subscriptions_renewals_only( $order_ids ) { | |
if ( defined( 'DOING_CRON' ) && DOING_CRON && function_exists( 'wcs_order_contains_subscription' ) ) { | |
$subscriptions = $renewals = array(); | |
$subscriptions = array_filter( $order_ids, 'wcs_order_contains_subscription' ); | |
$renewals = array_filter( $order_ids, 'wcs_order_contains_renewal' ); | |
$order_ids = array_merge( $subscriptions, $renewals ); | |
} | |
return $order_ids; | |
} | |
add_filter( 'wc_customer_order_csv_export_ids', 'sv_wc_customer_order_csv_auto_export_subscriptions_renewals_only' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment