WC_Checkout::is_shipping_withheld_for_missing_address │ private │ WC 1.0

Check whether shipping was left out because "Hide shipping costs until an address is entered" found the address incomplete.

Without this check an order could be saved with no shipping line, for example when a store removes billing address fields and the empty values are copied over the shipping address. Stores that turn off shipping calculation through the woocommerce_cart_ready_to_calc_shipping filter are left alone.

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

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

Возвращает

bool.

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

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

Код WC_Checkout::is_shipping_withheld_for_missing_address() WC 11.3.0

private function is_shipping_withheld_for_missing_address(): bool {
	if ( 'yes' !== get_option( 'woocommerce_shipping_cost_requires_address' ) || WC()->cart->has_calculated_shipping() ) {
		return false;
	}

	/**
	 * This filter is documented in includes/class-wc-cart.php.
	 *
	 * @since 2.7.0
	 */
	return (bool) apply_filters( 'woocommerce_cart_ready_to_calc_shipping', true );
}