Grouping shipping services and displaying the cheapest among them

The below code snippet can be used to group different services and then display the cheapest among them. Kindly copy the snippet in Appearance –> Editor –> functions.php.

In the above snippet, we can see that there are groups formed.

One group has been given the name “Mail Express” which contains the services “EXPRESS_MAIL” and “flat_rate_box_express”.

Similarly, another group is “Standard Mail” and contains “FIRST_CLASS” and “STANDARD_POST”.

So the snippet will search the cheapest rates among the services under “Mail Express” and “Standard Mail” and then display those in the cart page.

Leave a Reply