WC_Product_Data_Store_Interface::update_product_sales()
Update a product's sale count directly.
Uses queries rather than update_post_meta so we can do this in one query for performance.
Method of the class: WC_Product_Data_Store_Interface{}
No Hooks.
Return
null
. Nothing (null).
Usage
$WC_Product_Data_Store_Interface = new WC_Product_Data_Store_Interface(); $WC_Product_Data_Store_Interface->update_product_sales( $product_id, $quantity, $operation );
- $product_id(int) (required)
- Product ID.
- $quantity(int|null)
- Stock quantity to use for update.
Default: null - $operation(string)
- Either set, increase or decrease.
Default: 'set'
WC_Product_Data_Store_Interface::update_product_sales() WC Product Data Store Interface::update product sales code WC 9.4.2
public function update_product_sales( $product_id, $quantity = null, $operation = 'set' );