In shipping methods, is it possible to setup zones? For example rather that setting up a separate method for ever country in Europe, can I create a single shipping method for Europe and add in the European countries?
Thanks as always!
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It only takes a minute to sign up.
Sign up to join this communityIt's not possible to do using the CP. However, it's possible to write a simple shipping plugin, and group your shipping rules for various countries.
For example, you could put this into a file named store/libraries/store_shipping/store_shipping_example.php
:
class Store_shipping_example extends Store_shipping_driver
{
/**
* Calculate the shipping total for an order.
* Use print_r($order) to see all the fields available to you.
* The fields available also match those in the Checkout tag:
* http://exp-resso.com/docs/store/tags/checkout.html
*
* @param array $order
*/
public function calculate_shipping($order)
{
$eu_countries = array('uk', 'ie', 'fr', 'de', 'es', 'it');
if (in_array($order['shipping_country'], $eu_countries))
{
return 15.00;
}
else
{
return 30.00;
}
}
}