$product_ids ]; $products = $this->product_repository->find_sync_ready_products( $args )->get(); if ( empty( $products ) ) { throw JobException::item_not_found(); } $this->product_syncer->update( $products ); } /** * Schedule the job. * * @param array $args - arguments. * * @throws JobException If no product is provided as argument. The exception will be logged by ActionScheduler. */ public function schedule( array $args = [] ) { $args = $args[0] ?? []; $ids = array_filter( $args, 'is_integer' ); if ( empty( $ids ) ) { throw JobException::item_not_provided( 'Array of WooCommerce Product IDs' ); } if ( did_action( 'woocommerce_gla_batch_retry_update_products' ) ) { $this->action_scheduler->schedule_single( gmdate( 'U' ) + 60, $this->get_process_item_hook(), [ $ids ] ); } elseif ( $this->can_schedule( [ $ids ] ) ) { $this->action_scheduler->schedule_immediate( $this->get_process_item_hook(), [ $ids ] ); } } /** * Get an action hook to attach the job's start method to. * * @return StartHook */ public function get_start_hook(): StartHook { return new StartHook( 'woocommerce_gla_batch_retry_update_products', 1 ); } }