• Resolved daralraqi

    (@daralraqi)


    Im able to set the location of the customer based on geoip – however I need to disabled the select menu of country in both billing and shipping address..

    tried:

    add_filter( 'woocommerce_checkout_fields', 'checkout_country_fields_disabled' );
    function checkout_country_fields_disabled( $fields ) {
        $fields['billing']['billing_country']['custom_attributes']['disabled'] = 'disabled';
        $fields['billing']['shipping_country']['custom_attributes']['disabled'] = 'disabled';
    
        return $fields;
    }

    Didnt work – any help ???

Viewing 1 replies (of 1 total)
  • Saif

    (@babylon1999)

    Hello @daralraqi,

    If I understand you correctly, you want the shipping and billing country fields to be removed.

    Try this snippet:

    function custom_override_checkout_fields( $fields )    
    {
    unset($fields['billing']['billing_country']);
    unset($fields['shipping']['shipping_country']);
    
    return $fields;
    }
    add_filter('woocommerce_checkout_fields','custom_override_checkout_fields');

    Source

    Hope it helps!

Viewing 1 replies (of 1 total)
  • The topic ‘Disable select menu for country on checkout’ is closed to new replies.