Loading...

How to remove shipping countries from the checkout page (part 3)

Emilian F. Published on 25 October, 2011

This post will help you to show only the countries you want in the drop-downs on the checkout page when using single page checkout

Just copy-paste the code below to the footer.html template file.

    NOTE:
  1. the variable called countries holds the countries you want to be shown in the drop-down.

If you want to select a country, showing it as a default issue, please insert it's name in the text-box below and press OK. The code to be used will appear below.

OK

<script type="text/javascript">//<![CDATA[
$(document).ready(function(){

$('.ExpressCheckoutContent').ajaxSuccess(function(){

var countries = new Array("France","United States");

var cs = new Array();
var vals = new Array();

var i = 0;
var x = "";

$('#FormField_11 option').each(function(){
    cs[i] = $(this).text();

    vals[i] = $(this).attr('value');

    i++;
    $(this).remove();
});
for (var k = 0; k < countries.length; k++)

{
    for (var j = 0; j < cs.length; j++)

    {
        if (countries[k] == cs[j])

        {
            if (cs[j] == )

            {
                x = '<option selected="selected" value="' + vals[j] + '">' + cs[j] + '</option>';

            } else
            {
                x = '<option value="' + vals[j] + '">' + cs[j] + '</option>';

            }
            $('#FormField_11').append(x);
        }
    }

}
});
});
//]]></script>
Emilian F. Published on 25 October, 2011