WC_Abstract_Legacy_Product::reduce_stock
Deprecated since 3.0.0. It is no longer supported and may be removed in future releases. It is recommended to replace this function with the same one.
Reduce stock level of the product.
Method of the class: WC_Abstract_Legacy_Product{}
No Hooks.
Returns
Int. new stock level
Usage
$WC_Abstract_Legacy_Product = new WC_Abstract_Legacy_Product(); $WC_Abstract_Legacy_Product->reduce_stock( $amount );
- $amount(int)
- Amount to reduce by. Default: 1.
Default:1
Changelog
| Deprecated since | 3.0.0 |
WC_Abstract_Legacy_Product::reduce_stock() WC Abstract Legacy Product::reduce stock code WC 10.5.0
public function reduce_stock( $amount = 1 ) {
wc_deprecated_function( 'WC_Product::reduce_stock', '3.0', 'wc_update_product_stock' );
return wc_update_product_stock( $this, $amount, 'decrease' );
}