Skip to content

Instantly share code, notes, and snippets.

@amacneil
Created March 23, 2012 23:48
Show Gist options
  • Save amacneil/2176462 to your computer and use it in GitHub Desktop.
Save amacneil/2176462 to your computer and use it in GitHub Desktop.
An example custom shipping plugin for Expresso Store
<?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