Set a default country in Virtuemart 2 user registration / cart

For most Virtuemart shops, you will be primarily operating within a single country, and thus would like users to be able to quickly select your home country while checking out.  Users should not have to pour through a list of hundreds of countries.

Instead, it is better to have your default home country selected at the start, also so that the 'State' field is pre-populated with the correct values.  Insert the code below into administrator/components/com_virtuemart/helpers/shopfunctions.php, around like 262.  Right before return JHTML::_('select.genericlist', $countries, $idA, $attrs, $id, $name, $countryId);.  This function might vary depending upon your version of Virtuemart 2, but it is the last line of the function.  Also, just add the single line ABOVE our comment below, the second line is just there to show you where it will sit. It will look like the below (or close), when you are done. 223 is the country ID for the United States, replace this number with the ID of the country you wish to have pre-populated.

if($countryId == 0){$countryId = 223;}
//OS Ignite - If no country selected, then select US by default
return JHTML::_('select.genericlist', $countries, $idA, $attrs, $id, $name, $countryId);

 

Security & SSL

We take data security very seriously. Thus, your information is encrypted by a bank-grade, 256-bit SSL certificate during all secure transactions performed on our website.

Find Us

OS Ignite, Inc.
3420 Bristol St, Fl 6
Costa Mesa, CA 92626