WC_Checkout::is_shipping_withheld_for_missing_address
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.
Method of the class: WC_Checkout{}
Hooks from the method
Returns
bool.
Usage
// private - for code of main (parent) class only $result = $this->is_shipping_withheld_for_missing_address(): bool;
WC_Checkout::is_shipping_withheld_for_missing_address() WC Checkout::is shipping withheld for missing address code 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 );
}