wc_get_held_stock_quantity()
See how much stock is being held in pending orders.
Хуки из функции
Возвращает
int
.
Использование
wc_get_held_stock_quantity( $product, $exclude_order_id );
- $product(WC_Product) (обязательный)
- Product to check.
- $exclude_order_id(int)
- Order ID to exclude.
Список изменений
С версии 3.5.0 | Введена. |
Код wc_get_held_stock_quantity() wc get held stock quantity WC 9.2.3
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; } $reserve_stock = new ReserveStock(); return $reserve_stock->get_reserved_stock( $product, $exclude_order_id ); }