/** * Exports any non-exported orders to CSV and performs the chosen action (upload, HTTP POST, email) * * @since 3.0 */ public function auto_export_orders() { $order_statuses = (array) get_option('wc_customer_order_csv_export_auto_export_statuses'); /** * Query order IDs to export * * By default we get un-exported order IDs, * but this filter can change the query behavior * * @since 3.11.2 * @param array $query_args WP_Query args to fetch order IDs to export automatically * @param array $order_statuses Order statuses to export */ $query_args = apply_filters('wc_customer_order_csv_export_auto_export_order_query_args', array('fields' => 'ids', 'post_type' => 'shop_order', 'post_status' => empty($order_statuses) ? 'any' : $order_statuses, 'nopaging' => true, 'meta_key' => '_wc_customer_order_csv_export_is_exported', 'meta_value' => 0), $order_statuses); $query = new WP_Query($query_args); if (!empty($query->posts)) { // Export the queried orders $export = new WC_Customer_Order_CSV_Export_Handler($query->posts); $export->export_via(get_option('wc_customer_order_csv_export_auto_export_method')); } /** * Auto-Export Action. * * Fired when orders are auto-exported * * @since 3.0 * @param array $order_ids order IDs that were exported */ do_action('wc_customer_order_csv_export_orders_exported', $query->posts); }
/** * Exports any non-exported orders to CSV and performs the chosen action (upload, HTTP POST, email) * * @since 3.0 */ public function auto_export_orders() { $order_statuses = (array) get_option('wc_customer_order_csv_export_auto_export_statuses'); // get un-exported order IDs $query_args = array('fields' => 'ids', 'post_type' => 'shop_order', 'post_status' => empty($order_statuses) ? 'any' : $order_statuses, 'nopaging' => true, 'meta_key' => '_wc_customer_order_csv_export_is_exported', 'meta_value' => 0); $query = new WP_Query($query_args); if (!empty($query->posts)) { // export them! $export = new WC_Customer_Order_CSV_Export_Handler($query->posts); $export->export_via(get_option('wc_customer_order_csv_export_auto_export_method')); } /** * Auto-Export Action. * * Fired when orders are auto-exported * * @since 3.0 * @param array $order_ids order IDs that were exported */ do_action('wc_customer_order_csv_export_orders_exported', $query->posts); }