Basically I would like to show selected countries in the shipping and billing forms. Is there a correct way to achieve this?

I intend to use following JS:

    .append('<option value=""> </option><option data-title="United Kingdom" value="GB">United Kingdom</option>');

It works fine, but I'm curious is there any other correct method available to do this?

3 Answers 3


You can achieve this from admin panel. There is no need of writing any code.

Go to Admin Panel :

Stores->Configuration->Sales->tax->Default Tax Destination Calculation.

There you can select whatever countries or state you want to be showed.


I solved it at checkout using a plugin and modifying the country list in $jsLayout. In my case I only use US and Canada, so:

=> In Vendor/Module/etc/di.xml you add the next

 <type name="Magento\Checkout\Block\Checkout\LayoutProcessor">
            <plugin name="afterProcess" type="Vendor\Module\Block\LayoutProcessor"/>

=> And in Vendor/Module/Block/LayoutProcessor.php:

     public function afterProcess(
            \Magento\Checkout\Block\Checkout\LayoutProcessor $subject,
            array $jsLayout
            ['shippingAddress']['children']['shipping-address-fieldset']['children']['country_id']['options'] =
                        'value' => '',
                        'label' => ' ',
                    array (
                        'value' => 'CA',
                        'label' => 'Canada',
                        'is_region_required' => true,
                        'value' => 'US',
                        'label' => 'United States',
                        'is_region_required' => true,
        return $jsLayout;
  • its not working in magento 2.3 Commented Apr 26, 2019 at 6:34
  • It's not working
    – senthil
    Commented Nov 2, 2022 at 14:30

The best method to limit the country options in Billing & Shipping is through the store configuration.

Store>Configuration>General>Country Options

Set the "Allowed Countries" to your desired options.

A full set of instructions can be found at http://www.ecommercegorilla.com/setting-billing-shipping-countries-in-magento/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.