Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

E-Commerce Modules /

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba

[SOLVED] Delivery Price Modifier based on Cart Quantity

Go to End

2 Posts   866 Views


Community Member, 57 Posts

30 December 2011 at 8:52am

Hey guys,

I am looking to set up a delivery modifier that will adjust the pricing based on the following:

Domestic Shipping (within NZ) will be $7.50 for up to 3 items, and the same for any additional items ordered,
for example 1-3 items: $7.50, 4-6 items: $15.00, 7-9 items: $22.50 and so on.

International Shipping will be $15.00 per item flat rate.

Any thoughts on the best way to go about this?

I have started by setting the default rate to $15.00 and then will be looking to adjust the SimpleShippingModifier. My thoughts are to create a formula in here based on the number of items in the cart but being a bit of a newb i'm not sure of the best way to get / reference this variable in the modifier?

Any clues?

Thank you,


Community Member, 57 Posts

31 December 2011 at 10:58am

Solved. So managed to figure this out and have achieved the desired result by adjusting SimpleShippingModifier.php as below:

[line 63]

function LiveAmount() {

//Get the Current Order
$o = ShoppingCart::current_order();
$total = $o->SubTotal();
$orderItems = $o->Items();
// Calculate the total quantity of the order
foreach($orderItems as $orderItem){
$totalQuantity += $orderItem->Quantity;

if ($this->LiveCountry() == "NZ"){

$postage = $totalQuantity / 3;
$postage = ceil($postage);
$postage = 7.50 * $postage;
return $postage;

else {
$postage = $totalQuantity * 15;
return $postage;

//return $this->LiveIsDefaultCharge() ? self::$default_charge : self::$charges_by_country[$this->LiveCountry()];