woocommerce_no_stock action-hookWC 4.9

Action to signal that the value of 'stock_quantity' for a variation is about to change.

Usage

add_action( 'woocommerce_no_stock', 'wp_kama_woocommerce_no_stock_action' );

/**
 * Function for `woocommerce_no_stock` action-hook.
 * 
 * @param int $product The variation whose stock is about to change.
 *
 * @return void
 */
function wp_kama_woocommerce_no_stock_action( $product ){

	// action...
}
$product(int)
The variation whose stock is about to change.

Changelog

Since 4.9 Introduced.

Where the hook is called

wc_trigger_stock_change_notifications()
woocommerce_no_stock
wc_trigger_stock_change_actions()
woocommerce_no_stock
woocommerce/includes/wc-stock-functions.php 259
do_action( 'woocommerce_no_stock', wc_get_product( $change['product']->get_id() ) );
woocommerce/includes/wc-stock-functions.php 324
do_action( 'woocommerce_no_stock', $product );

Where the hook is used in WooCommerce

Usage not found.