woocommerce_product_before_set_stock
Action to signal that the value of 'stock_quantity' for a product is about to change.
Usage
add_action( 'woocommerce_product_before_set_stock', 'wp_kama_woocommerce_product_before_set_stock_action' ); /** * Function for `woocommerce_product_before_set_stock` action-hook. * * @param int $product The product whose stock is about to change. * * @return void */ function wp_kama_woocommerce_product_before_set_stock_action( $product ){ // action... }
- $product(int)
- The product whose stock is about to change.
Changelog
Since 4.9 | Introduced. |
Where the hook is called
woocommerce_product_before_set_stock
woocommerce_product_before_set_stock
woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php 596
do_action( 'woocommerce_product_before_set_stock', $product );
woocommerce/includes/wc-stock-functions.php 45
do_action( 'woocommerce_product_before_set_stock', $product_with_stock );