woocommerce_variation_set_stock

woocommerce_variation_set_stock

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: action
See hook in action

See hook in core

Displaying hooks found in version: woocommerce.8.7.0

do_action('woocommerce_variation_set_stock') is found 2 times:

  • /includes/data-stores/class-wc-product-data-store-cpt.php line 671
    		}
    
    		if ( in_array( 'stock_quantity', $this->updated_props, true ) ) {
    			if ( $product->is_type( 'variation' ) ) {
    				do_action( 'woocommerce_variation_set_stock', $product );
    			} else {
    				do_action( 'woocommerce_product_set_stock', $product );
    			}
    		}
    
    		if ( in_array( 'stock_status', $this->updated_props, true ) ) {
    
  • /includes/wc-stock-functions.php line 61
    		}
    
    		// Fire actions to let 3rd parties know the stock changed.
    		if ( $product_with_stock->is_type( 'variation' ) ) {
    			do_action( 'woocommerce_variation_set_stock', $product_with_stock );
    		} else {
    			do_action( 'woocommerce_product_set_stock', $product_with_stock );
    		}
    
    		return $product_with_stock->get_stock_quantity();
    	}
    

See this hook used in plugins: