Search

Index

Revindex Storefront

How to hide unwanted country

Last updated on 2016-06-05 1 mins. to read

If there are countries your business doesn't sell to, you can easily disable the unwanted countries under Configuration > General settings.

For older Storefront prior to v9.0, you can use Javascript to hide the available countries from the dropdown list. Simply, create a custom display template for the Checkout module control.

For example, you can put this Javascript right below your ASP panel tag to remove all countries except U.S and Canada:

<asp:Panel ID="BillingAndShippingPanel" runat="server"> 
<script type="text/javascript">
function pageLoad(sender, args)
{
        jQuery("select[id$='BillingCountryDropDownList'] option[value!='US']option[value!='CA']").remove();
        jQuery("select[id$='ShippingCountryDropDownList'] option[value!='US']option[value!='CA']").remove(); 
}
</script> 


Make sure there is a space between the select[xxx] option[aaa]option[bbb] and no space between the option[aaa]option[bbb]. The correct spacing is important here.

Comments

Peter Jul 25, 2017 8:11 PM
For Version 9 and higher, can you provide a script that will set the configuration to all but a single country? The task of clearing all the check boxes for all but one country is daunting. :-)
Stephen Lim Jul 27, 2017 3:00 PM
You can set it to "US" only. For US and Canada, you would set it to "US|CA".  Please take a backup before making SQL changes.

UPDATE Revindex_Storefront_Configuration SET GeneralCountryAllowed = 'US' WHERE PortalID = 0

Powered by Revindex Wiki