woocommerce_product_set_stock
Action to signal that the value of 'stock_quantity' for a product has changed.
Usage
add_action( 'woocommerce_product_set_stock', 'wp_kama_woocommerce_product_set_stock_action' ); /** * Function for `woocommerce_product_set_stock` action-hook. * * @param WC_Product $product The variation whose stock has changed. * * @return void */ function wp_kama_woocommerce_product_set_stock_action( $product ){ // action... }
- $product(WC_Product)
- The variation whose stock has changed.
Changelog
Since 3.0 | Introduced. |
Where the hook is called
woocommerce_product_set_stock
woocommerce_product_set_stock
woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php 792
do_action( 'woocommerce_product_set_stock', $product );
woocommerce/includes/wc-stock-functions.php 73
do_action( 'woocommerce_product_set_stock', $product_with_stock );