Magento – Magento 1.8.1 – Remove other shipping methods if free shipping is active on Estimate Shipping Block

estimatemagento-1.8shipping

I have an eshop developed using Magento 1.8.1.

I managed to remove other shipping methods if free shipping is active on my order page adding this code

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

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

My problem though is that all shipping methods still appear on "Estimate Shipping Block"

So what i need is when free shipping is activated, other shipping options to be hidden on Estimate Shipping Block

Best Answer

The file you need to adjust is:

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

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

 <?php
if ( array_key_exists('freeshipping', $_shippingRateGroups )) {
unset($_shippingRateGroups["flatrate"]);
}
?>

I notified that above procedure not worked for you take a look at another procedure here

Related Topic