woocommerce_own_stock_hold_exclusion_threshold_minutes
Filters how many minutes must pass before a shopper's own unpaid stock hold stops blocking that same shopper.
The exclusion is disabled by default. Enabling it can create multiple payable orders for the same stock and cause overselling if an older payment later completes. Return 0 to exclude the shopper's own holds immediately.
Usage
add_filter( 'woocommerce_own_stock_hold_exclusion_threshold_minutes', 'wp_kama_woocommerce_own_stock_hold_exclusion_threshold_minutes_filter', 10, 3 );
/**
* Function for `woocommerce_own_stock_hold_exclusion_threshold_minutes` filter-hook.
*
* @param int|false $threshold_minutes Threshold in minutes, or false to keep the exclusion disabled.
* @param int $product_id Product whose reserved stock is being counted.
* @param int $exclude_order_id Order already excluded by the caller.
*
* @return int|false
*/
function wp_kama_woocommerce_own_stock_hold_exclusion_threshold_minutes_filter( $threshold_minutes, $product_id, $exclude_order_id ){
// filter...
return $threshold_minutes;
}
- $threshold_minutes(int|false)
- Threshold in minutes, or false to keep the exclusion disabled.
- $product_id(int)
- Product whose reserved stock is being counted.
- $exclude_order_id(int)
- Order already excluded by the caller.
Changelog
| Since 11.3.0 | Introduced. |
Where the hook is called
woocommerce_own_stock_hold_exclusion_threshold_minutes
woocommerce/src/Checkout/Helpers/ReserveStock.php 363
$threshold_minutes = apply_filters( 'woocommerce_own_stock_hold_exclusion_threshold_minutes', false, $product_id, $exclude_order_id );