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