Created
August 26, 2013 12:01
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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