Guys i need an advice on how can i achieve this shipping rule

1) Shipping cost should be at a minimum of US$25.00 or 10% of the total purchase.

Example 1:

Total Purchase = $25
Shipping cost = $25
Total = $50

Example 2:

Total Purchase = $500
Shipping cost = $50
Total purchase = $550.00


  • there might be a way using backend, but u can use event n observer to achieve this simply on shipping address save event.
    – Shathish
    Jul 11, 2013 at 4:56

3 Answers 3


You can create a new shipping module following this tutorial or this one. Then the collectRates() method (the one responsible for calculating the shipping price) can look something like this:

public function collectRates(Mage_Shipping_Model_Rate_Request $request){
    // skip if not enabled
    if (!Mage::getStoreConfig('carriers/'.$this->_code.'/active')) {
        return false;
    //create a result object
    $result = Mage::getModel('shipping/rate_result');
    $percentage = 10;
    $minimum = 25;
    $packageValue = $request->getPackageValue();//the cost of the products
    $price = ($pachageValue * $percentage) / 100; //calculate 10% of the product cost
    if ($price < $minimum){//if 10% is less than 25
        $price = $minimum;
    //create new shipping method instance
    $method = Mage::getModel('shipping/rate_result_method');
    //set the price for the method instance
    //add the price to results
    return $result;

For best practice, add the minimum amount (25) and the percentage value (10) to your module configuration so you will be able to change it whenever you want.


For set shipping cost you need to create .CSV file. let try this will help you.

  • no u cannot use fixed price and percentage on a single shot
    – Shathish
    Jul 11, 2013 at 7:00
  • it is not possible to get percentage from total through the csv?
    – MageDev
    Jul 11, 2013 at 7:06
  • I think so, but even if possible, the requirement is fixed charge minimum of $25 and 10% thereafter, so default table rate cannot serve the purpose. If u wanna try, try the answer frm Marius
    – Shathish
    Jul 11, 2013 at 7:10
  • @Shathish, right, Can't we Do same thing with csv as Marius said?
    – MageDev
    Jul 11, 2013 at 7:24
  • of course we can, but it will give u more pain, which is not a mandatory thing for the requirement. i'll continue your chatroom in couple of hours :)
    – Shathish
    Jul 11, 2013 at 7:46

Tables Rate Method can be used by uploading CSV for different rates and area is a good solution.

Admin: System->Configuration->Sales->Shipping Method

Check the Link for using Tables Rate Method

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.