Ask your WordPress questions! Pay money and get answers fast! (more info)

WooCommerce - include pre-orders in report by product WordPress

  • SOLVED

I'd like to know how many pre-orderable products have been purchased within certain date rangers. Unfortunately WooCommerce Pre-Orders doesn't add reporting functionality.

I've added pre-orderable products in the 'sales by date' report by adding 'pre-ordered'

'order_status' => array( 'completed', 'processing', 'on-hold', 'pre-ordered' ),

Could anybody let me know what to add to <em>class-wc-report-sales-by-product.php</em> so that it counts pre-orderable products that have been paid for?

Answers (1)

2015-06-01

Dbranes answers:

I wonder if you could use the <em>woocommerce_reports_order_statuses</em> filter?

Something like the following (untested):

add_filter( 'woocommerce_reports_order_statuses', 'wpq__reports_order_statuses' );

function wpq__reports_order_statuses ( $order_status ) {
$order_status[] = 'pre-ordered';
return $order_status;
}


or refine it further with the <em>woocommerce_reports_get_order_report_data_args</em> filter.