Change flat rate shipping price

This article is about how we can change flat rate shipping charge. There are many scenarios like –
1. If a cart having few specified items from some category we need to change flat rate shipping.
2. For a particular area (country, state or zip) we need to change flat rate shipping.
And more on this not only flat rate shipping we many need to manipulate other shipping methods also.

So, if you know the shipping method id, it is easily achievable. Here I have showed how to modify flat rate shipping. But you can replace ‘flat_rate’ with your own method id.

You can put the line ‘$rates[$key]->cost = 25;’ under any condition. And remember you have a variable ‘$package’ which contains items of cart/package so you can loop through it and check for shipping classes or product category and apply logic according to it.

3 Replies to “Change flat rate shipping price”

  1. Here says:
  2. directory says:

Leave a Reply

Your email address will not be published. Required fields are marked *