Magento – Hide/disable standard shipping when qualified for free shipping

free-shippingmagento-1.8moduleshipping

I have read the other suggestions for similar problems but I have not solved my issue yet.

I'm using standard shipping (with tablerates.csv) and free shipping on orders over $50 plus a flat rate for customers that want express post.

The problem is that when a customer qualifies for free shipping the standard shipping still shows up as an option. (It should just disappear and only leave "Free" and "Express" as the 2 options.)

I am not using a "Shopping Cart Price Rule" for free shipping as this introduces a different set problems.

Can someone suggest the simplest way to stop Magento from displaying the Standard/Table rates once the free shipping threshold has been reached.

(Or even suggest an extension that solves the issue or clarify answers given to Hide other shipping methods when free shipping is enabled)

Any help would be greatly appreciated.

Best Answer

Create a module with the following config.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <Shipping_Onepage>
            <version>1.0.0</version>
        </Shipping_Onepage>
    </modules>
    <global>
        <blocks>
            <checkout>
                <rewrite>
                    <onepage_shipping_method_available>Shipping_Onepage_Block_Method</onepage_shipping_method_available>
                </rewrite>
            </checkout>
        </blocks>
    <global>
</config>

This is the rewritten class in Shipping/Onepage/Block/Method.php, which removes all other methods if free shipping is available:

   <?php
    class Shipping_Onepage_Block_Method extends Mage_Checkout_Block_Onepage_Shipping_Method_Available
{
    public function getShippingRates()
    {
        $rates = parent::getShippingRates();
        if (array_key_exists('freeshipping', $rates)) {
            $rates = array('freeshipping' => $rates['freeshipping']);
        }

        return $rates;
    }
}

Source: http://www.blog.magepsycho.com/hide-other-shipping-methods-when-free-shipping-is-enabled/

Related Topic