News:

Support the VirtueMart project and become a member

Main Menu

Auto-select shipping method based on country [SOLVED]

Started by MaryB, June 22, 2013, 17:59:02 PM

Previous topic - Next topic

MaryB

I'm working on a Joomla 2.5/Virtuemart 2.0.20b site for a friend. He has two shipping methods configured (using the built-in weight, countries, zip module): one for shipping within the U.S., one for shipping anywhere else in the world. He would like to have the shipment method selected automatically, based on the country the user selects in the shipping address form. Currently, when the customer clicks on  the "select shipping method" link, they are taken to another page where they are presented with the one shipping method appropriate to the country in their shipping address. This works ok, but is kind of a klunky way to do it, for his purposes.

What I would like to do is automatically populate the shipping method in their cart upon successful submission of the shipping/billing information form, thereby allowing them to skip the extra step of going to another page to select a shipping method when there is only one method available to them.

At the point in the process where they have entered their shipping address, it seems that the country they entered is available to the scripts, is it not? I'm confident that I can code an if/else to accomplish this, but I haven't been able to discover which files I would need to override. As I see it, the address variables are being called and displayed in the cart, so I'll need to extract the country variable, and run my if/else in the spot that currently displays the "Select shipping method" link.

Can anyone point me in the right direction?

Thanks!

[EDIT] I'm not sure what I did to fix this, but initially, I had the cart configured to "Enable Automatic Selected Shipment", and for whatever reason, customers in the United Kingdom were able to select a shipping method that was only enabled for customers in the United States. I then disabled the "Enable Automatic Selected Shipment", and posted my question here. Grasping at straws, I re-enabled that setting, and now it's working as expected. When a customer inputs their billing/shipping address, they are returned to the main cart page with the correct shipping method already selected based on the country field input. Still a mystery, but at least it works.



Limonbay

Did you find an answer for this? I'm in the same situation you describe  :(
Piercings y complementos
http://www.limonbay.com
Joomla 2.5.14
Virtuemart 2.0.24