Created
March 23, 2012 23:48
-
-
Save amacneil/2176462 to your computer and use it in GitHub Desktop.
An example custom shipping plugin for Expresso Store
This file contains 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
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
/** | |
* Store Shipping Example | |
* | |
* An example custom shipping plugin for Expresso Store | |
*/ | |
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; | |
} | |
} | |
} | |
/* End of file ./libraries/store_shipping/store_shipping_example.php */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment