Recently I was working in Joomla application and application have shipping functionality and I want to limit free shipping for a specific country in Virtuemart component within Joomla 1.5.
Joomla is a one of the most widely used Open Source Content Management System.It allows you to specify specific country which will be allowed free shipping in Virtuemart while the others will have normal shipping options. It works with the free shipping limit specify in the Virtuemart store configurations.
First of all, Open the class file ps_checkout.php from path administrator/components/com_virtuemart/classes and find vm_ps_checkout function in ps_checkout file.
Add following query into the vm_ps_checkout function:
1 2 3 4 5 | $db = new ps_DB; $q = "SELECT country from #__{vm}_user_info WHERE user_info_id = '" . $vars["ship_to_info_id"] . "'"; $db->query($q); |
Place below if condition before the condition “if( $vendor_freeshipping > 0 && $vars[‘order_subtotal_withtax’] >= $vendor_freeshipping)” condition:
1 2 3 | if( $db->f("country") == "US") |
That’s it.Here, User the country code here the US is the code of the country you wish to allow free shipping too.
Must Read:
Browser Detection with Joomla
Free shipping for specific Country in Virtuemart Joomla
To use Pagination in Joomla
Thanks for reading and feel free to share your thoughts! Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.