wc_get_held_stock_quantity( WC_Product $product, integer $exclude_order_id )
See how much stock is being held in pending orders.
Description Description
Parameters Parameters
- $product
-
(Required) Product to check.
- $exclude_order_id
-
(Required) Order ID to exclude.
Return Return
(int)
Source Source
File: includes/wc-stock-functions.php
function wc_get_held_stock_quantity( WC_Product $product, $exclude_order_id = 0 ) { /** * Filter: woocommerce_hold_stock_for_checkout * Allows enable/disable hold stock functionality on checkout. * * @since 4.3.0 * @param bool $enabled Default to true if managing stock globally. */ if ( ! apply_filters( 'woocommerce_hold_stock_for_checkout', wc_string_to_bool( get_option( 'woocommerce_manage_stock', 'yes' ) ) ) ) { return 0; } return ( new \Automattic\WooCommerce\Checkout\Helpers\ReserveStock() )->get_reserved_stock( $product, $exclude_order_id ); }
Changelog Changelog
Version | Description |
---|---|
3.5.0 | Introduced. |