This code allows you to specify one country which will be allowed free shipping in Virtuemart while the others still retain normal shipping options. This works in hand with the free shipping limit specify in the the Virtuemart store configurations.
Credits: This is a tweak of the code pasted by #nickdwhite to the Virtuemart forums almost 4 years ago. Thanks Nick!
1.) Open the class file: administrator/components/com_virtuemart/classes/ps_checkout.php
2.) Find the following line of code:
Code: Select all
if( $vendor_freeshipping > 0 && $vars['order_subtotal_withtax'] > $vendor_freeshipping) {
Code: Select all
$db = new ps_DB;
$q = "SELECT country from #__{vm}_user_info WHERE user_info_id = '" . $vars["ship_to_info_id"] . "'";
$db->query($q);
if( $vendor_freeshipping > 0 && $vars['order_subtotal_withtax'] >= $vendor_freeshipping && $db->f("country") == "NZL") {
5.) Specify the free shipping limit by clicking on Edit Store in the Virtuemart control panel (you will find it in the Store Information section of the page).
6.) Specify shipping rates for countries you want to ship to but that are not eligible for free shipping (or else they will not be able complete checkout)
Note: You will also need to set shipping rates for any sales under your free shipping limit, within your country.
Hope this helps someone!!!
