diff --git a/plugins/woocommerce/changelog/pr-35743 b/plugins/woocommerce/changelog/pr-35743 new file mode 100644 index 00000000000..217aa519b84 --- /dev/null +++ b/plugins/woocommerce/changelog/pr-35743 @@ -0,0 +1,4 @@ +Significance: patch +Type: update + +Modify the possibly_schedule_import function to return the order id \ No newline at end of file diff --git a/plugins/woocommerce/src/Internal/Admin/Schedulers/OrdersScheduler.php b/plugins/woocommerce/src/Internal/Admin/Schedulers/OrdersScheduler.php index 8e06f1f2138..f8b4929ce18 100644 --- a/plugins/woocommerce/src/Internal/Admin/Schedulers/OrdersScheduler.php +++ b/plugins/woocommerce/src/Internal/Admin/Schedulers/OrdersScheduler.php @@ -40,7 +40,7 @@ class OrdersScheduler extends ImportScheduler { // Order and refund data must be run on these hooks to ensure meta data is set. add_action( 'woocommerce_update_order', array( __CLASS__, 'possibly_schedule_import' ) ); - add_action( 'woocommerce_create_order', array( __CLASS__, 'possibly_schedule_import' ) ); + add_filter( 'woocommerce_create_order', array( __CLASS__, 'possibly_schedule_import' ) ); add_action( 'woocommerce_refund_created', array( __CLASS__, 'possibly_schedule_import' ) ); OrdersStatsDataStore::init(); @@ -210,13 +210,15 @@ AND status NOT IN ( 'wc-auto-draft', 'trash', 'auto-draft' ) * @param int $order_id Post ID. * * @internal + * @returns int The order id */ public static function possibly_schedule_import( $order_id ) { if ( ! OrderUtil::is_order( $order_id, array( 'shop_order' ) ) && 'woocommerce_refund_created' !== current_filter() ) { - return; + return $order_id; } self::schedule_action( 'import', array( $order_id ) ); + return $order_id; } /**