Automattic\WooCommerce\Internal\Admin\Schedulers

OrdersScheduler::maybe_schedule_import_on_untrash │ public static │ WC 11.1.0

Driven off the status transition rather than woocommerce_untrash_order, which fires before the restored status is saved — so an import running synchronously would record wc-trash, and nothing corrects it because the data store suppresses woocommerce_update_order for trash transitions.

CPT reaches this via its own save, so it is handled by untrashed_post instead.

Метод класса: OrdersScheduler{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$result = OrdersScheduler::maybe_schedule_import_on_untrash( $order_id, $from_status ): void;
$order_id(int) (обязательный)
Order ID.
$from_status(строка) (обязательный)
Status the order transitioned from.

Список изменений

С версии 11.1.0 Введена.

Код OrdersScheduler::maybe_schedule_import_on_untrash() WC 11.3.0

public static function maybe_schedule_import_on_untrash( $order_id, $from_status ): void {
	if ( OrderStatus::TRASH !== $from_status ) {
		return;
	}

	if ( ! OrderUtil::custom_orders_table_usage_is_enabled() ) {
		return;
	}

	self::possibly_schedule_import( $order_id );
}