woocommerce_shipping_calculator_enable_state filter-hookWC 8.4.0

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

WC_Cart::show_shipping()
woocommerce_shipping_calculator_enable_state
woocommerce/includes/class-wc-cart.php 1584
$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 ) ) : ?>

Where the hook is used in WooCommerce

Usage not found.