Change default country selected in shipping / billing addres

Posted by Community Admin on 04-Aug-2018 17:16

Change default country selected in shipping / billing address?

All Replies

Posted by Community Admin on 20-Jun-2012 00:00

Currently, the default country selected for the checkout widget in address information is Algeria.  How can I change that?

Posted by Community Admin on 22-Jun-2012 00:00

Hello, Ryan.

Thank you for contacting us.

The Checkout widget is a complex. largely self-contained control that currently does not have the level of configurability required to change which country is displayed in that dropdown. You would have to create your own checkout widget. If that interests you, please take a look at this blog post which discusses custom checkout and has source code.

I apologize for any inconvenience. Please let us know if you have any further questions.

All the best,
Randy Hodge
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 22-Jun-2012 00:00

Is there a way to change it using javascript (i.e. during a onload event)?

Posted by Community Admin on 03-Nov-2012 00:00

Anyone still interested in this here was my solution, adapted from Telerik's internal JS that gets called.

Add this to the bottom of your Shipping/billing address form template:

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function pageLoad()
          var countryShipping = $find($(".sfCountryShipping").attr("id"));
          var countryBilling = $find($(".sfCountryBilling").attr("id"));         
          countryShipping ? countryShipping.findItemByValue('AU').select() : 0;
          countryBilling ? countryBilling.findItemByValue('AU').select() : 0;
        
     </script>
</telerik:RadCodeBlock>

The ternary :0 is required, because this code actually gets run through twice on page load for some reason, the 1st time $find will return 'null'...

Posted by Community Admin on 03-Nov-2012 00:00

Just had a thought & caveat.  This setup is for a shop that doesn't allow sign in, and therefore the country/state fields are not pre-populated...

Not sure how this will interfere with pre-populated fields, please bear in mind.

This thread is closed