Automattic\WooCommerce\Internal\PushNotifications\Triggers
StockNotificationTrigger::add_notification
Creates a stock notification and adds it to the pending store.
Метод класса: StockNotificationTrigger{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->add_notification( $product_id, $event_type, ?int $stock_quantity_at_trigger ): void;
- $product_id(int) (обязательный)
- The product ID.
- $event_type(строка) (обязательный)
- The stock event type.
- ?int $stock_quantity_at_trigger
- .
По умолчанию:null
Код StockNotificationTrigger::add_notification() StockNotificationTrigger::add notification WC 10.9.1
private function add_notification( int $product_id, string $event_type, ?int $stock_quantity_at_trigger = null ): void {
if ( $product_id <= 0 ) {
return;
}
wc_get_container()->get( PendingNotificationStore::class )->add(
new StockNotification( $product_id, $event_type, $stock_quantity_at_trigger )
);
}