woocommerce_product_before_set_stock action-hookWC 4.9

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

WC_Product_Data_Store_CPT::update_post_meta()
woocommerce_product_before_set_stock
wc_update_product_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 );

Where the hook is used in WooCommerce

Usage not found.