woocommerce_shipping_calculator_enable_state

woocommerce_shipping_calculator_enable_state

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.9.8.1

apply_filters('woocommerce_shipping_calculator_enable_state') is found 2 times:

  • /includes/class-wc-cart.php line 1608
    1604
    1605
    1606
    1607
    1608
    1609
    1610
    1611
    1612
    1613
    1614
    * @since 8.4.0
     *
     * @param bool $show_state Whether to use the state field. Default true.
     */
    $state_enabled  = apply_filters( 'woocommerce_shipping_calculator_enable_state', true );
    $state_required = isset( $country_fields['shipping_state'] ) && $country_fields['shipping_state']['required'];
    if ( $state_enabled && $state_required && ! $this->get_customer()->get_shipping_state() ) {
        return false;
    }
    /**
     * Filter to not require shipping postcode for shipping calculation, even if it is required at checkout.
  • /templates/cart/shipping-calculator.php line 42
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
            </select>
        </p>
    <?php endif; ?>
     
    <?php if ( apply_filters( 'woocommerce_shipping_calculator_enable_state', true ) ) : ?>
        <p class="form-row form-row-wide" id="calc_shipping_state_field">
            <?php
            $current_cc = WC()->customer->get_shipping_country();
            $current_r  = WC()->customer->get_shipping_state();
            $states     = WC()->countries->get_states( $current_cc );

Examples using woocommerce_shipping_calculator_enable_state