WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Checkout\Helpers

ReserveStock::get_reserved_stock() public WC 1.0

Query for any existing holds on stock for this item.

{} It's a method of the class: ReserveStock{}

No Hooks.

Return

Int. Amount of stock already reserved.

Usage

$ReserveStock = new ReserveStock();
$ReserveStock->get_reserved_stock( $product, $exclude_order_id );
$product(\WC_Product) (required)
Product to get reserved stock for.
$exclude_order_id(int)
Optional order to exclude from the results.

Code of ReserveStock::get_reserved_stock() WC 5.9.0

public function get_reserved_stock( $product, $exclude_order_id = 0 ) {
	global $wpdb;

	if ( ! $this->is_enabled() ) {
		return 0;
	}

	// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQL.NotPrepared
	return (int) $wpdb->get_var( $this->get_query_for_reserved_stock( $product->get_stock_managed_by_id(), $exclude_order_id ) );
}