woocommerce_order_hold_stock_minutes filter-hookWC 8.8.0

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.

Usage

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.
Default: woocommerce_hold_stock_minutes or 10 if block checkout entry
$order(\WC_Order)
Order object.

Changelog

Since 8.8.0 Introduced.

Where the hook is called

ReserveStock::reserve_stock_for_order()
woocommerce_order_hold_stock_minutes
woocommerce/src/Checkout/Helpers/ReserveStock.php 80
$minutes = (int) apply_filters( 'woocommerce_order_hold_stock_minutes', $minutes, $order );

Where the hook is used in WooCommerce

Usage not found.