HomeHome Product Discus... Product Discus...RazorCartRazorCartChanging the default country on the checkout pageChanging the default country on the checkout page
Previous
 
Next
New Post
6/27/2017 1:28 PM
 
On the cart page, under shipping and billing address, how can I make United States the default country in the country dropdown list?

The first step is to go into the RazorCart admin console and edit the "Checkout" view.

To initial a value at the page load event you can use ngInit, the following can be placed anywhere in the "_Shipping.cshtml" but I will place it on the same html object (country drop-down menu)

<select name="shipCountry" class="form-control" ng-model="checkout.shipping.CountryID" ng-change="checkout.shipCountryChange()" ng-init="checkout.shipping.CountryID = '221'; checkout.shipCountryChange()" required>

So I added ng-init to set the country id to 221 which is the entry value for "United States" and then I called the country change function to update the region list according to selected country.
The country/region values are populated using the DNN Localization List, if you wish to view/edit this list check the dbo.List table.
 
Previous
 
Next
HomeHome Product Discus... Product Discus...RazorCartRazorCartChanging the default country on the checkout pageChanging the default country on the checkout page