Automattic\WooCommerce\StoreApi\Utilities
CartController::get_remaining_stock_for_product()
Gets remaining stock for a product.
Method of the class: CartController{}
No Hooks.
Return
Int
.
Usage
// protected - for code of main (parent) or child class $result = $this->get_remaining_stock_for_product( $product );
- $product(\WC_Product) (required)
- Product object.
CartController::get_remaining_stock_for_product() CartController::get remaining stock for product code WC 9.3.3
protected function get_remaining_stock_for_product( $product ) { $reserve_stock = new ReserveStock(); $qty_reserved = $reserve_stock->get_reserved_stock( $product, $this->get_draft_order_id() ); return $product->get_stock_quantity() - $qty_reserved; }