woocommerce_order_hold_stock_minutes
Filters the number of minutes an order should reserve stock for.
This hook allows the number of minutes that stock in an order should be reserved for to be filtered, useful for third party developers to increase/reduce the number of minutes if the order meets certain criteria, or to exclude an order from stock reservation using a zero value.
Использование
add_filter( 'woocommerce_order_hold_stock_minutes', 'wp_kama_woocommerce_order_hold_stock_minutes_filter', 10, 2 ); /** * Function for `woocommerce_order_hold_stock_minutes` filter-hook. * * @param int $minutes How long to reserve stock for the order in minutes. * @param \WC_Order $order Order object. * * @return int */ function wp_kama_woocommerce_order_hold_stock_minutes_filter( $minutes, $order ){ // filter... return $minutes; }
- $minutes(int)
- How long to reserve stock for the order in minutes.
По умолчанию: woocommerce_hold_stock_minutes or 10 if block checkout entry - $order(\WC_Order)
- Order object.
Список изменений
С версии 8.8.0 | Введена. |
Где вызывается хук
woocommerce_order_hold_stock_minutes
woocommerce/src/Checkout/Helpers/ReserveStock.php 80
$minutes = (int) apply_filters( 'woocommerce_order_hold_stock_minutes', $minutes, $order );