Magento – Hide Other Shipping Methods when free shipping is applicable

With your e-commerce store, there might be scenario that where we have to offer Free Shipping over some minimum order to customers. Magento provides this configuration from admin panel but has a little usability issue. Though free shipping is applicable on check out page it also displays other shipping methods(paid) and customer has to select Free Shipping Method as option.  Good news is that we can override this behavior  and hide other shipping method when free shipping is applicable. Below are steps to do.

  1. Go to Below Path and find available.phtml

app/ design/ frontend/ default/ youtheme/ template/ checkout/ onepage/ shipping_method/ available.phtml

  1.  Paste the below code right before <dl> tag
<?php

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

$_shippingRateGroups = array('freeshipping' => $_shippingRateGroups['freeshipping']);

}

?>

Basically we are overriding $_shippingRateGroups array variable with only one element as free shipping when we found ‘freeshipping’ in array.

Hope this helps!!! Happy Coding!

(Visited 21 times, 1 visits today)