WordPress at Your Fingertips
function is not described

WC_Product_Data_Store_Interface::update_product_stock() public WC 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).

{} It's a method of the class: WC_Product_Data_Store_Interface{}

No Hooks.

Return

null. Nothing.

Usage

$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(int|null)
Stock quantity to update to.
Default: null
$operation(string)
Either set, increase or decrease.
Default: 'set'

Code of WC_Product_Data_Store_Interface::update_product_stock() WC 5.7.1

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