Loading...

How to remove shipping countries from your BigCommerce Template (part 1)

Daniel C. Published on 18 August, 2011

You probably want to ship products only to specific locations. By default, the BigCommerce templates allow you to create shipping zones but, I think is odd that the rest of the countries still appear in the list when a customer chooses the shipping address.

That's why I am posting this script: to help you to remove the 'unwanted' countries from the list.

This script only works for the multiple page checkout option, to get the script for the single page checkout then please click on the following link: Remove Shipping Countries From Single-Page Checkout.

Paste the code below into the footer.html template file. The affected pages will be the checkout page and the account creation page.


<script type="text/javascript">//<![CDATA[
var countries = new Array("United States","Romania","France","Germany");
var i = 0;
var lng = countries.length;
for(i = 0; i < lng; i++)
{
$('#FormField_11 option').each(function(){
if($(this).text().search(countries[i]) >= 0)
{$(this).remove();};
});
}
//]]></script>


NOTE:

  1. you can populate the countries array with the countries to remove
  2. make sure to go to Settings -> Checkout Settings and select "Multiple Page Checkout"

If you change the template you need to create a backup of this code in order to put it back after the new template have been applied.

Daniel C. Published on 18 August, 2011