Search code examples
woocommercehook-woocommercewoocommerce-theming

Cart page address aren't show in checkout page billing details area. But Ship to a different address area show the correct one


How to forcefully auto selected Bulling details field like cart page address filed information. Ship to a different address area show the right one but Bulling details area isn't.

enter image description here

enter image description here


Solution

  • add_filter( 'default_checkout_billing_state', 'mehedi_change_default_checkout_state' );
    function mehedi_change_default_checkout_state() {
        $state = WC()->customer->get_shipping_state();
        return $state; // state code
    }