Automattic\WooCommerce\Internal\PushNotifications\Triggers

NewOrderNotificationTrigger::on_new_order │ public │ WC 10.7.0

Handles the woocommerce_new_order hook.

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

Хуков нет.

Возвращает

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

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

$NewOrderNotificationTrigger = new NewOrderNotificationTrigger();
$NewOrderNotificationTrigger->on_new_order( $order_id, $order ): void;
$order_id(int) (обязательный)
The order ID.
$order(WC_Order) (обязательный)
The order object.

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

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

Код NewOrderNotificationTrigger::on_new_order() WC 11.3.0

public function on_new_order( int $order_id, WC_Order $order ): void {
	if ( ! in_array( $order->get_status(), self::NOTIFIABLE_STATUSES, true ) ) {
		return;
	}

	wc_get_container()->get( PendingNotificationStore::class )->add(
		new NewOrderNotification( $order_id )
	);
}