WC_Product_Data_Store_Interface::update_product_stock()publicWC 1.0

Update a product's stock amount directly.

Uses queries rather than update_post_meta so we can do this in one query (to avoid stock issues).

Method of the class: WC_Product_Data_Store_Interface{}

No Hooks.


null. Nothing (null).


$WC_Product_Data_Store_Interface = new WC_Product_Data_Store_Interface();
$WC_Product_Data_Store_Interface->update_product_stock( $product_id_with_stock, $stock_quantity, $operation );
$product_id_with_stock(int) (required)
Product ID.
Stock quantity to update to.
Default: null
Either set, increase or decrease.
Default: 'set'

WC_Product_Data_Store_Interface::update_product_stock() code WC 9.0.1

public function update_product_stock( $product_id_with_stock, $stock_quantity = null, $operation = 'set' );