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.
etc.
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 Responses

  1. Here
    Here July 25, 2017 at 9:42 pm | | Reply

    Finally I found what I was looking for, only took 4 pages of search results.

  2. directory
    directory July 16, 2017 at 9:14 pm | | Reply

    I simply want to tell you that I’m new to blogging and absolutely savored this blog. More than likely I’m want to bookmark your website . You definitely have really good writings. Kudos for sharing your web site.

Leave a Reply