Jump to content

Archived

This topic is now archived and is closed to further replies.

GemRock

Set/Change default shipping method

Recommended Posts

I know there's a contribution for this, but for those who simply want to set to default a shipping method of his/her choice, which is not the cheapest, then here is a simpler, quicker way of doing it:

 

1. open [catalog]includes/classes/shipping.php for edit. Look for at around line 112 & 115 these two lines of code:

$cheapest = $rates[$i];

and change both to:

$cheapest = $rates[0];

2. in admin, modules - shipping, give/change the sort order of the shipping method you want to set as default to 1, ie, the top most, or you will need to the '0' in

$rates[0]

as shown above to a number that corresponds to your chosen shipping method's sort order, eg, 1 for sort order 2.

 

No other change is needed.

Ken


commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Share this post


Link to post
Share on other sites
I know there's a contribution for this, but for those who simply want to set to default a shipping method of his/her choice, which is not the cheapest, then here is a simpler, quicker way of doing it:

 

1. open [catalog]includes/classes/shipping.php for edit. Look for at around line 112 & 115 these two lines of code:

$cheapest = $rates[$i];

and change both to:

$cheapest = $rates[0];

2. in admin, modules - shipping, give/change the sort order of the shipping method you want to set as default to 1, ie, the top most, or you will need to the '0' in

$rates[0]

as shown above to a number that corresponds to your chosen shipping method's sort order, eg, 1 for sort order 2.

 

No other change is needed.

Ken

 

Was just about to install that contribution as I've just setup a store pickup rate (which then became the default choice as its free - not too great) - you have saved me a lot of time. Thanks!

Share this post


Link to post
Share on other sites

Thanks!!! I was digging through the contributions for something to sort my shipping methods, as I had the same problem with the cheapest method. I couldn't really find anything that suited my problem, so I decided to google for tips and stumbled on your post :thumbsup: :thumbsup:

Share this post


Link to post
Share on other sites

Thank you very much, just what I was looking for.


Always be nice to other people, you never know when you might need something from them...

Share this post


Link to post
Share on other sites

Thank you!

 

I know there's a contribution for this, but for those who simply want to set to default a shipping method of his/her choice, which is not the cheapest, then here is a simpler, quicker way of doing it:

 

1. open [catalog]includes/classes/shipping.php for edit. Look for at around line 112 & 115 these two lines of code:

$cheapest = $rates[$i];

and change both to:

$cheapest = $rates[0];

2. in admin, modules - shipping, give/change the sort order of the shipping method you want to set as default to 1, ie, the top most, or you will need to the '0' in

$rates[0]

as shown above to a number that corresponds to your chosen shipping method's sort order, eg, 1 for sort order 2.

 

No other change is needed.

Ken

Share this post


Link to post
Share on other sites

Another alternative is to make it so that the cheapest non-free shipping rate is the default by simply changing the IF at line 111

 

FROM:

 

if ($rates[$i]['cost'] < $cheapest['cost']) {

 

TO:

 

if (($rates[$i]['cost'] < $cheapest['cost']) && ($rates[$i]['cost'] > 0)) {

 

That's what works best for me, hopefully it'l help others too.

Share this post


Link to post
Share on other sites

×