WC_Product::set_stock_quantity
Set number of items available for sale.
Method of the class: WC_Product{}
No Hooks.
Returns
null. Nothing (null).
Usage
$WC_Product = new WC_Product(); $WC_Product->set_stock_quantity( $quantity );
- $quantity(float|null) (required)
- Stock quantity.
Changelog
| Since 3.0.0 | Introduced. |
WC_Product::set_stock_quantity() WC Product::set stock quantity code WC 10.5.0
public function set_stock_quantity( $quantity ) {
$this->set_prop( 'stock_quantity', '' !== $quantity ? wc_stock_amount( $quantity ) : null );
}