woocommerce_variation_set_stock
Action to signal that the value of 'stock_quantity' for a variation has changed.
Использование
add_action( 'woocommerce_variation_set_stock', 'wp_kama_woocommerce_variation_set_stock_action' ); /** * Function for `woocommerce_variation_set_stock` action-hook. * * @param WC_Product $product The variation whose stock has changed. * * @return void */ function wp_kama_woocommerce_variation_set_stock_action( $product ){ // action... }
- $product(WC_Product)
- The variation whose stock has changed.
Список изменений
С версии 3.0 | Введена. |
Где вызывается хук
woocommerce_variation_set_stock
woocommerce_variation_set_stock
woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php 756
do_action( 'woocommerce_variation_set_stock', $product );
woocommerce/includes/wc-stock-functions.php 69
do_action( 'woocommerce_variation_set_stock', $product_with_stock );