3

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

3 Answers 3

5

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

2

Well you can go with other way to achieve what you need. Instead of creating one more shipping method in configuration which is called Free shipping you could set Shopping cart price rule. Then in Estimate shipping cost you will have automatic 0,00 in your shipping method staying same. It's not exact what you wanted in first place but in my opinion it's solving user experience problem with free shipping as he clearly can choose the shipping method of his choice with still seeing that he has achieved free shipping.

http://www.magentocommerce.com/wiki/3_-_store_setup_and_management/shopping-cart-price-rule-recipes

2

Override the file at below location by copying it into your stores theme folder :

app/design/frontend/base/default/template/checkout/cart/shipping.phtml

folder location to copy the above file :

app/design/frontend/yourtemplate/default/template/checkout/cart/shipping.phtml

and add the code below exact before

<dl class="sp-methods">

tag,

code to be added :

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.