WC_Coupon_Data_Store_CPT::get_tentative_held_timeprivateWC 1.0

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.

Метод класса: WC_Coupon_Data_Store_CPT{}

Хуки из метода

Возвращает

int.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->get_tentative_held_time();

Код WC_Coupon_Data_Store_CPT::get_tentative_held_time() WC 10.0.2

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;
}