woocommerce_product_set_stock action-hookWC 3.0

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

WC_Product_Data_Store_CPT::handle_updated_props()
woocommerce_product_set_stock
wc_update_product_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 );

Where the hook is used in WooCommerce

Usage not found.