Automattic\WooCommerce\Internal\PushNotifications\Triggers
StockNotificationRecoveryHandler::register
Registers the recovery hook.
Hooks both woocommerce_product_set_stock woocommerce_variation_set_stock variations dispatch a separate action (see wc-stock-functions.php). The trigger side fires for variations too, so without the variation hook a variable product's sent-meta would never clear.
Method of the class: StockNotificationRecoveryHandler{}
No Hooks.
Returns
null. Nothing (null).
Usage
$StockNotificationRecoveryHandler = new StockNotificationRecoveryHandler(); $StockNotificationRecoveryHandler->register(): void;
Changelog
| Since 10.9.0 | Introduced. |
StockNotificationRecoveryHandler::register() StockNotificationRecoveryHandler::register code WC 11.0.1
public function register(): void {
add_action( 'woocommerce_product_set_stock', array( $this, 'on_stock_change' ) );
add_action( 'woocommerce_variation_set_stock', array( $this, 'on_stock_change' ) );
}