Put shipping cost in order by lowest rate

I am trying to figure out how to put the shipping rates at check out in order with the lowest rate first. The only post I can seem to find about it is for version 1 at…

Order by Shipping Rate - v1.x Configuration - CS-Cart Community Forums

…but this does not seem to apply to version 2.2.4(5). Is there maybe a setting that does this? For me it makes logical sense for it to pick the least expensive but I know every one does not see it like that. The problem is that many of the people coming to our site will see only the main shipping cost and not understand there are other options. So what seems to make sense is to just make the lowest shipping cost the default option for them.


Do your shipping methods change, if not and it is manual then In shipping settings see position field in screenshot.


The problem we have is we offer pricing for UPS and multiple options for USPS. We used to try just UPS but we lost a lot of business because many times they tend to be way off base for lighter orders that are under 3-4 pounds. So we have the following options in order using the position field…

  1. First Class Mail - USPS
  2. Flat Rate Envelope - USPS
  3. Priority Mail
  4. Parcel Select
  5. Standard Ground (UPS or Fedex)

    If something is too heavy then 1st Class and Flat Rate Envelope won't even show up. The problem is it shows the next 3 options in the order listed. Sometimes priority mail is cheaper for a customer, sometimes UPS is cheaper. It varies big time. So I am trying to figure out how to make it go to the cheapest option for the customer.

    It is funny because even since the time I posted this another customer just called and said she we were charging too much. When we looked at her “abandoned cart” we saw what she had ordered, put it in the cart ourselves and again all she was looking at was the first shipping option. Which this time is was Priority Mail by default but because she was in Oklahoma and the package would be about 5 pounds the UPS would be the best price. Again, this is not always the case. So it is not something we can manually set. That is why we were hoping that someone figured out how to set the system to choose the “lowest shipping cost” for the customer so it doesn't scare them off.

I have a post for a similar problem. On the checkout.cart page, sometimes the more expensive shipping is shown initially, while the lower shipping cost is not shown until the customer selects shipping options and sees the options. They may never do this, so I wanted to know how I can make the shipping estimator box to open on onload and stay open on the checkout.cart page. I don't think there is a problem on the checkout.checkout page. I found an old post myself, but was with a 1.3 cart.

Clips, are you having the similar problem on the checkout.cart page or the checkout.checkout page?



The ideal solution would be for an option to show them in cost order, with lowest selected by default. I had a real struggle to get this working by having multiple shipping options - i.e. duplicating the same ones. The trick is to put them in order so that the one most likely to be economical is higher (but keep the others available in case the others are more economical).

Here is an example:

Priority mail 10-25kg

UPS 10-25kg

UPS 25kg upwards

Priority mail 25kg upwards

10-25kg this will show priority mail as the first option (with UPS as second option).

Over 25kg it will then show UPS as the first option (with Priority Mail as the second option).

Take care to ensure that once a customer has selected one option that it is removed as the weight comes down - i.e. notice that in the above example you need both UPS rates and cannot have one just 10kg upwards. If it was simplly “over 10kg” it would work as the customer increases the amount in the basket, but when items are then removed, the option is still selected by default (although it would no longer be the highest in the list it is the rate used even if not selected by the customer). You therefore have to remove the option for shipping to default back to the top of the list as you go up / down the weight ranges (which can get somewhat complex).

I know this isn't the ideal way as you really want a way to show them in order of price / cheapest first (me too!) but this is a work-around that I found works if you know what is likely to be the most economical method, whilst still giving the customer the choice in case this assumption is wrong.


I'm not for sure what you are meaning. It does show all of the options both at “checkout” and “view cart”. The only thing I am trying to do is get it to make the cheapest shipping the default or initial option instead of whatever is at the top of the customers choices.

Below is a pic from the “estimate” or view cart page.


Here is the image from the actual checkout page.


So it looks like they are the same, they just do not end up in order by actual price.


What you have listed appears to be close to what we have already rigged up. With the exception of showing things like Priority Mail twice. The problem we have is, depending on where a customer lives and how much the order weighs, the best shipping option for them changes. Sometimes it is better for them to go UPS, sometimes USPS. We ship our orders internally the same way. We go for the lowest cost shipping option without downgrading what the customer chooses. What I am trying to figure out how to do is to make the lowest shipping option become the default or first shipping option for each customer. This way they get the lower cost and then they have to change it if they want something different.


I see what you mean. When a person goes to the cart page they see a more expensive shipping cost. In your case, they see the 16.70. They may never click to at least see the less expensive 11.09. They may just think that the only option is 16.70. This is what I think is happening to me. I would like the shipping estimator to be open by default all the time, and like you, have the shipping methods in low to high order also.



Or at least some way to have them all UNSELECTED then force customer to choose shipping “oops you have not chosen a shipping method”

Just saved another customer! Because of the way the current system does not go to the lowest shipping price by default, another customer just called us to tell us “our shipping was too high”. Once we showed them how it showed several different options they understood and they were able to chose the less expensive method.

[quote name='clips' timestamp='1343496959' post='141736']

I am trying to figure out how to put the shipping rates at check out in order with the lowest rate first. The only post I can seem to find about it is for version 1 at…


…but this does not seem to apply to version 2.2.4(5).


It does work. Just a little different.

Edit core/fn.cart.php


function fn_apply_cart_shipping_rates(&$cart, &$cart_products, &$auth, &$shipping_rates)
$cart['shipping_failed'] = true;


function compare($x, $y) {

if ( $x['rates'] == $y['rates'] )

return 0;

else if ( $x['rates'] < $y['rates'] )

return -1;


return 1;


usort($shipping_rates, 'compare');

Better yet here it is packaged as an addon. No core file editing required :)



Very nice, but I am guessing I am doing something wrong on the install. It does sort things for me, but it does not seem to allow me to actually choose a particular method. It appears to default to just UPS for us. This happens in both the “estimate” area and on the one page check out area.


Just asking the question I had above. It's now a problem for me. I have CS-CART Pro 2.2.4

I would like to know what code I have to change and where, in order by default, have the estimated shipping box be open.

This is on the checkout.cart page.

I don't want the customer to have to click “Get rates and Choose Shipping Method”

I have a Free shipping choice and a paid Priority Choice ( in case free ground is not fast enough).

Currently, by default, the customer sees the Priority charge and not the Free Shipping Option.

I will probably get calls that there is suppose to be free shipping, but I am charging 5.95. I want to avoid this by having the estimation box open by default.

Looks like it's more difficult than in 1.3 version.

Would appreciate any help.



We ended up just turning off the estimation and it has not been as confusing for customers. I believe this is one of the “minor” details that CS has over looked and not put much thought in to.


I thought it was a plus that a customer can get an estimate as to what their shipping costs are, before they check out. Before this, I would constantly get emails or calls asking what is the shipping cost.

I think it works well, except for automatically showing the highest cost shipping option as the default. The customer then thinks that's the only shipping method and leaves, not knowing that there is a free shipping option available, if they click on the link.


Without a doubt I would prefer to have the shipping estimate on. The problem is this is a poor function/design that does not choose the cheapest shipping method automatically. Not to mention, customers will choose a different one in the shopping cart but if they don't hit save it goes back to a default shipping method and the customer gets angry because they think we are trying to scam them.

I tried the mod that soulsouvivor gave but had problems with it.

Does anyone has solution to this? I need the shopping cart to select the lowest shipping rate too. Thank you!

Yes, I will also need this. Does anybody know a way to do it?