From 1c711eeb167ce38ceee9ba0839c2ed53148b9f55 Mon Sep 17 00:00:00 2001 From: sanesh-acowebs <109509377+sanesh-acowebs@users.noreply.github.com> Date: Mon, 9 Oct 2023 15:36:59 +0530 Subject: [PATCH] Updated possibly_schedule_import function to return order id (#35743) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: NĂ©stor Soriano --- plugins/woocommerce/changelog/pr-35743 | 4 ++++ .../src/Internal/Admin/Schedulers/OrdersScheduler.php | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 plugins/woocommerce/changelog/pr-35743 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; } /**