Automattic\WooCommerce\Internal\PushNotifications\Triggers

StockNotificationTrigger::on_backorder │ public │ WC 10.9.0

Handles the woocommerce_product_on_backorder hook.

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

Хуков нет.

Возвращает

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

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

$StockNotificationTrigger = new StockNotificationTrigger();
$StockNotificationTrigger->on_backorder( $args ): void;
$args(массив) (обязательный)
Backorder event data.

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

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

Код StockNotificationTrigger::on_backorder() WC 11.3.0

public function on_backorder( array $args ): void {
	$product = $args['product'] ?? null;

	if ( ! $product instanceof WC_Product ) {
		return;
	}

	$this->add_notification( $product->get_id(), StockNotification::EVENT_ON_BACKORDER );
}