I wish to modify the shipping cost Double if they add more than 5 items at the cart.

class ChangeShipping_MyCarrier_Model_Carrier extends
    Mage_Shipping_Model_Carrier_Abstract implements
    protected function _getStandardShippingRate()
        $rate = Mage::getModel('shipping/rate_result_method');

        $items_count = Mage::helper('checkout/cart')->getItemsCount();
        if ($items_count > 6) {
        } else {
        return $rate;

This function executes flawless without IF condition but shows error then.

  • What is the error that you're getting? Jan 15, 2016 at 13:24
  • I suggest you add a Mage::log($items_count) you might find that the count isnt actually what you are thinking. Ie if you add a configurable product, is it giving you 1 or 2? (simple+configurable). Moreover, do you want qty to be factored in? See this question: magento.stackexchange.com/questions/23491/… Jan 15, 2016 at 14:03

1 Answer 1


In the carrier model please use $request object, and not the $cart object, as we can create the order from admin, API and other sources. See example here:


You need is to modify the collectRates based on you logic:

if ($request->getPackageQty() > 6) { // modify price }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.