WC_Product_Data_Store_Interface::update_product_stock()
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).
Метод класса: WC_Product_Data_Store_Interface{}
Хуков нет.
Возвращает
null
. Ничего (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) (обязательный)
- Product ID.
- $stock_quantity(int|null)
- Stock quantity to update to.
По умолчанию: null - $operation(строка)
- Either set, increase or decrease.
По умолчанию: 'set'
Код WC_Product_Data_Store_Interface::update_product_stock() WC Product Data Store Interface::update product stock WC 8.7.0
public function update_product_stock( $product_id_with_stock, $stock_quantity = null, $operation = 'set' );