Execute single order pending jobs immediately when wp_debug is enabled (https://github.com/woocommerce/woocommerce-admin/pull/1581)
* Execute all pending jobs when debug mode is enabled * Only process single order jobs immediately * Replace wp_debug condition with a filter * Bypass scheduling and process the order on save_post * Change hook name to include order
This commit is contained in:
parent
73ff2d37e8
commit
08e43c35cf
|
@ -28,6 +28,10 @@ There are also some helper scripts:
|
|||
- `npm run i18n` : A multi-step process, used to create a pot file from both the JS and PHP gettext calls. First it runs `i18n:js`, which creates a temporary `.pot` file from the JS files. Next it runs `i18n:php`, which converts that `.pot` file to a PHP file. Lastly, it runs `i18n:pot`, which creates the final `.pot` file from all the PHP files in the plugin (including the generated one with the JS strings).
|
||||
- `npm test` : Run the JS test suite
|
||||
|
||||
To debug synced lookup information in the database, you can bypass the action scheduler and immediately sync order and customer information by using the `woocommerce_disable_order_scheduling` hook.
|
||||
|
||||
`add_filter( 'woocommerce_disable_order_scheduling', '__return_true' );`
|
||||
|
||||
## Privacy
|
||||
|
||||
If you have enabled WooCommerce usage tracking ( option `woocommerce_allow_tracking` ) then, in addition to the tracking described in https://woocommerce.com/usage-tracking/, this plugin also sends information about the actions that site administrators perform to Automattic - see https://automattic.com/privacy/#information-we-collect-automatically for more information.
|
||||
|
|
|
@ -132,6 +132,11 @@ class WC_Admin_Reports_Sync {
|
|||
return;
|
||||
}
|
||||
|
||||
if ( apply_filters( 'woocommerce_disable_order_scheduling', false ) ) {
|
||||
self::orders_lookup_process_order( $order_id );
|
||||
return;
|
||||
}
|
||||
|
||||
// This can get called multiple times for a single order, so we look
|
||||
// for existing pending jobs for the same order to avoid duplicating efforts.
|
||||
$existing_jobs = self::queue()->search(
|
||||
|
@ -169,7 +174,7 @@ class WC_Admin_Reports_Sync {
|
|||
// Activate WC_Order extension.
|
||||
WC_Admin_Order::add_filters();
|
||||
|
||||
add_action( 'save_post_shop_order', array( __CLASS__, 'schedule_single_order_process' ) );
|
||||
add_action( 'save_post', array( __CLASS__, 'schedule_single_order_process' ) );
|
||||
add_action( 'woocommerce_order_refunded', array( __CLASS__, 'schedule_single_order_process' ) );
|
||||
|
||||
WC_Admin_Reports_Orders_Stats_Data_Store::init();
|
||||
|
@ -219,7 +224,7 @@ class WC_Admin_Reports_Sync {
|
|||
'order' => 'ASC',
|
||||
)
|
||||
);
|
||||
$order_ids = $order_query->get_orders();
|
||||
$order_ids = $order_query->get_orders();
|
||||
|
||||
foreach ( $order_ids as $order_id ) {
|
||||
self::orders_lookup_process_order( $order_id );
|
||||
|
|
Loading…
Reference in New Issue