woocommerce_updated_product_stock
Fire an action for this direct update so it can be detected by other code.
Usage
add_action( 'woocommerce_updated_product_stock', 'wp_kama_woocommerce_updated_product_stock_action' );
/**
* Function for `woocommerce_updated_product_stock` action-hook.
*
* @param int $product_id_with_stock Product ID that was updated directly.
*
* @return void
*/
function wp_kama_woocommerce_updated_product_stock_action( $product_id_with_stock ){
// action...
}
- $product_id_with_stock(int)
- Product ID that was updated directly.
Changelog
| Since 3.6 | Introduced. |
Where the hook is called
woocommerce_updated_product_stock
woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php 1818
do_action( 'woocommerce_updated_product_stock', $product_id_with_stock );
Where the hook is used in WooCommerce
woocommerce/src/Internal/Caches/ProductCacheController.php 97
add_action( 'woocommerce_updated_product_stock', array( $this, 'invalidate_product_cache' ), 10, 1 );
woocommerce/src/Internal/Caches/ProductVersionStringInvalidator.php 79
add_action( 'woocommerce_updated_product_stock', array( $this, 'handle_woocommerce_updated_product_stock' ), 10, 1 );