Skip to content

Instantly share code, notes, and snippets.

@ijy
Created August 26, 2013 12:01
Show Gist options
  • Select an option

  • Save ijy/6340752 to your computer and use it in GitHub Desktop.

Select an option

Save ijy/6340752 to your computer and use it in GitHub Desktop.
A custom shipping plugin for Exp:resso Store (v1) allowing you to group shipping rules for various countries. Place this class in a file named: store/libraries/store_shipping/store_shipping_zones.php
class Store_shipping_zones 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;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment