Automattic\WooCommerce\Internal\PushNotifications\Triggers
StockNotificationTrigger::on_no_stock
Handles the woocommerce_no_stock hook.
Method of the class: StockNotificationTrigger{}
No Hooks.
Returns
null. Nothing (null).
Usage
$StockNotificationTrigger = new StockNotificationTrigger(); $StockNotificationTrigger->on_no_stock( $product ): void;
- $product(WC_Product) (required)
- The product that is out of stock.
Changelog
| Since 10.9.0 | Introduced. |
StockNotificationTrigger::on_no_stock() StockNotificationTrigger::on no stock code WC 10.9.1
public function on_no_stock( WC_Product $product ): void {
$this->add_notification( $product->get_id(), StockNotification::EVENT_OUT_OF_STOCK );
}