woocommerce_variation_before_set_stock

woocommerce_variation_before_set_stock

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: action

See hook in core

Displaying hooks found in version: woocommerce.8.7.0

do_action('woocommerce_variation_before_set_stock') is found 2 times:

  • /includes/data-stores/class-wc-product-data-store-cpt.php line 587
    						* @since 4.9
    						*
    						* @param int $product The variation whose stock is about to change.
    						*/
    						do_action( 'woocommerce_variation_before_set_stock', $product );
    					} else {
    						/**
    						* Action to signal that the value of 'stock_quantity' for a product is about to change.
    						*
    						* @since 4.9
    						*
    
  • /includes/wc-stock-functions.php line 43
    		$data_store            = WC_Data_Store::load( 'product' );
    
    		// Fire actions to let 3rd parties know the stock is about to be changed.
    		if ( $product_with_stock->is_type( 'variation' ) ) {
    			do_action( 'woocommerce_variation_before_set_stock', $product_with_stock );
    		} else {
    			do_action( 'woocommerce_product_before_set_stock', $product_with_stock );
    		}
    
    		// Update the database.
    		$new_stock = $data_store->update_product_stock( $product_id_with_stock, $stock_quantity, $operation );