Remove Magento Shipping Methods if Free Shipping available

Posted: November 29, 2014 in How To?, Magento
Tags: ,

If you offer Free Shipping to your customers, then you may have noticed that the default Shipping Methods are still displayed when the Free Shipping Method activates. This can be confusing for the shopper and they need another click to select the “Free Shipping” over the existing rates.

The following code will hide the other shipping methods from the shopping cart page, the default magento checkout and one page checkout.

The file you need to adjust is: app/ design/ frontend/ default/ YOURTEMPLATE/ template/ checkout/ onepage/ shipping_method/ available.phtml

Place the following code right before the <dl> tag that displays the different options.

if ( array_key_exists('freeshipping', $_shippingRateGroups )) {
$_shippingRateGroups = array('freeshipping' => $_shippingRateGroups['freeshipping']);

You can even just unset specific Shipping Methods such as the “Flat Rate Method” using:

if ( array_key_exists('freeshipping', $_shippingRateGroups )) {

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s