A Small Code To Limit The List Of Countries In A Clickfunnels Order Form

I modified the script provided here Translating Country list selector in Clickfunnels 2 step order form that allows to translate country names in the countries drop down in Clickfunnels, and came up with the one below that can be used to only keep certain countries in your country options.

This short script can be helpful when only shipping to a limited number of countries as it makes the country selection much smoother/easier for your potential prospects thus hopefully increasing the conversion rate a bit (if at all).

PS. I modified the code to make sure it also respects the order in which the countries are given, the countries will be sorted in the same order.

<script>
$(function() {
    let CountriesToKeep = [
     {name:"CA", translation:"Canada"},
     {name:"ES", translation:"Spain"},
     {name:"US", translation:"United States"},
     // Add new countries after this...
    ];

    $(`[name="shipping_country"] option, [name="country"] option`).remove();
        
    CountriesToKeep.forEach(x => {
        $(`[name="shipping_country"], [name="country"]`).append(`<option value="${x.name}">${x.translation}</option>`);
    });
});
</script>

How to use it?

Step 1: Copy the code above into your Clickfunnels’ step

Copy the code as-is into your order form’s Tracking code > Footer Code box (can work for any step where there is a country or shipping country dropdown box).

Step 2: Change CountriesToKeep array

By removing those existing entries or adding new ones if you wish, you can add new entries by appending this line:

{name:"A", translation:"B"},

After the "// Add new countries after this..." , the comma ‘,’ is part of the line.

Replace A with the ISO-2 country code, and replace B with the translation you want to be shown instead (if wishing to change how the country name is shown).

Step 3: Save changes!

Save your changes and try it out…

And voila!

@yassine

1 Like

Thanks, very useful!