diff --git a/woo-business-central/includes/class-wbc-batch-sync.php b/woo-business-central/includes/class-wbc-batch-sync.php index ad75db7..f3d77d6 100644 --- a/woo-business-central/includes/class-wbc-batch-sync.php +++ b/woo-business-central/includes/class-wbc-batch-sync.php @@ -51,7 +51,7 @@ class WBC_Batch_Sync { * Register the Action Scheduler batch handler */ public function register_hooks() { - add_action( self::ACTION_HOOK, array( $this, 'process_batch' ), 10, 1 ); + add_action( self::ACTION_HOOK, array( $this, 'process_batch' ), 10, 2 ); } /** @@ -169,12 +169,15 @@ class WBC_Batch_Sync { /** * Process a single batch (called by Action Scheduler) * - * @param array $args Action args: run_id, product_ids. + * Action Scheduler spreads the associative args array passed to + * as_enqueue_async_action() into separate positional parameters here + * (it does not pass a single combined array) - the parameter order + * must match the key order used when the action was enqueued. + * + * @param string $run_id Run ID this batch belongs to. + * @param array $product_ids WooCommerce product IDs in this batch. */ - public function process_batch( $args ) { - $run_id = $args['run_id'] ?? ''; - $product_ids = $args['product_ids'] ?? array(); - + public function process_batch( $run_id, $product_ids = array() ) { $run = get_option( self::RUN_OPTION, array() ); // A newer sync superseded this run (e.g. re-triggered manually) - drop it.