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