woocommerce_shipping_calculator_enable_postcode
Filter to not require shipping postcode for shipping calculation, even if it is required at checkout. This can be used to allow shipping calculations to be done without a postcode.
Usage
add_filter( 'woocommerce_shipping_calculator_enable_postcode', 'wp_kama_woocommerce_shipping_calculator_enable_postcode_filter' ); /** * Function for `woocommerce_shipping_calculator_enable_postcode` filter-hook. * * @param bool $show_postcode Whether to use the postcode field. * * @return bool */ function wp_kama_woocommerce_shipping_calculator_enable_postcode_filter( $show_postcode ){ // filter... return $show_postcode; }
- $show_postcode(true|false)
- Whether to use the postcode field.
Default: true
Changelog
Since 8.4.0 | Introduced. |
Where the hook is called
woocommerce_shipping_calculator_enable_postcode
woocommerce/includes/class-wc-cart.php 1621
$postcode_enabled = apply_filters( 'woocommerce_shipping_calculator_enable_postcode', true );
woocommerce/templates/cart/shipping-calculator.php 84
<?php if ( apply_filters( 'woocommerce_shipping_calculator_enable_postcode', true ) ) : ?>