WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

WC_Shipping_Free_Shipping::is_available() public WC 1.0

See if free shipping is available based on the package and cart.

{} Это метод класса: WC_Shipping_Free_Shipping{}

Хуки из метода
Возвращает

true/false.

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

$WC_Shipping_Free_Shipping = new WC_Shipping_Free_Shipping();
$WC_Shipping_Free_Shipping->is_available( $package );
$package(массив) (обязательный)
Shipping package.

Код WC_Shipping_Free_Shipping::is_available() WC 4.7.1

<?php
public function is_available( $package ) {
	$has_coupon         = false;
	$has_met_min_amount = false;

	if ( in_array( $this->requires, array( 'coupon', 'either', 'both' ), true ) ) {
		$coupons = WC()->cart->get_coupons();

		if ( $coupons ) {
			foreach ( $coupons as $code => $coupon ) {
				if ( $coupon->is_valid() && $coupon->get_free_shipping() ) {
					$has_coupon = true;
					break;
				}
			}
		}
	}

	if ( in_array( $this->requires, array( 'min_amount', 'either', 'both' ), true ) ) {
		$total = WC()->cart->get_displayed_subtotal();

		if ( WC()->cart->display_prices_including_tax() ) {
			$total = $total - WC()->cart->get_discount_tax();
		}

		if ( 'no' === $this->ignore_discounts ) {
			$total = $total - WC()->cart->get_discount_total();
		}

		$total = NumberUtil::round( $total, wc_get_price_decimals() );

		if ( $total >= $this->min_amount ) {
			$has_met_min_amount = true;
		}
	}

	switch ( $this->requires ) {
		case 'min_amount':
			$is_available = $has_met_min_amount;
			break;
		case 'coupon':
			$is_available = $has_coupon;
			break;
		case 'both':
			$is_available = $has_met_min_amount && $has_coupon;
			break;
		case 'either':
			$is_available = $has_met_min_amount || $has_coupon;
			break;
		default:
			$is_available = true;
			break;
	}

	return apply_filters( 'woocommerce_shipping_' . $this->id . '_is_available', $is_available, $package, $this );
}