WC_Coupon_Data_Store_CPT::get_tentative_held_time
Get held time for resources before cancelling the order. It will use woocommerce_coupon_hold_minutes to get the value, defaulting to woocommerce_hold_stock_minutes option if set, with a 1-minute minimum if set to 0. Note that the filter woocommerce_coupon_hold_minutes support minutes because it's getting used elsewhere as well, however this function returns in seconds.
Method of the class: WC_Coupon_Data_Store_CPT{}
Hooks from the method
Returns
Int.
Usage
// private - for code of main (parent) class only $result = $this->get_tentative_held_time();
WC_Coupon_Data_Store_CPT::get_tentative_held_time() WC Coupon Data Store CPT::get tentative held time code WC 10.7.0
private function get_tentative_held_time() {
$default_hold_time_minutes = (int) get_option( 'woocommerce_hold_stock_minutes', 1 );
if ( 0 >= $default_hold_time_minutes ) {
// Held time is at least 1 minute if `woocommerce_hold_stock_minutes` is set to 0.
$default_hold_time_minutes = 1;
}
/**
* Filter the tentative hold time in minutes for a coupon before it expires.
*
* @since 3.7.0
*
* @param int $default_hold_time_minutes The default hold time for coupons in minutes.
*/
return (int) apply_filters( 'woocommerce_coupon_hold_minutes', $default_hold_time_minutes ) * 60;
}