Magento: Remove a Shipping Method in Frontend

Magento: Remove a Shipping Method in Frontend

September 16, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento: Remove a Shipping Method in Frontend

Disabling Shipping Methods in Magento Frontend Without Touching Templates

Hello developers! I recently came across an interesting question on our forums about disabling shipping methods in the Magento frontend without touching templates or changing module status. Since it’s a common issue, let me share how you can achieve this using XML configuration and custom blocks.

Understanding the Problem

The main challenge here is to hide specific shipping carriers from the frontend without editing any templates (which isn’t an option for extensions released on Magento Connect) or disabling them entirely in the backend. This requires a strategic approach that involves configuring your module correctly.

Solving the Issue: The XML Configuration Way

The key lies in using Magento’s layout XML configuration to control which blocks are rendered in the frontend. Here’s how you can do it:

Step 1: Identify the Relevant Block

First, you need to identify the block that renders the shipping methods in the checkout process. In Magento, this is the onepage_shipping_method_availible block located under checkout.

Step 2: Define Your Custom Block

Create a custom block class that extends the original Mage_Checkout_Block_Onepage_Shipping_Method_Available. This new class will be responsible for handling shipping method availability. Here’s an example:

class YOUR_VENDOR_Block_Checkout_Onepage_Shipping_Method_Available
    extends Mage_Checkout_Block_Onepage_Shipping_Method_Available
{
    public function getShippingRates()
    {
        if (empty($this->_rates)) {
            $this->getAddress()->collectShippingRates()->save();

            $groups = $this->getAddress()->getGroupedAllShippingRates();

            return $this->_rates = $groups;
        }

        return $this->_rates;
    }
}

Step 3: Configure Your Custom Block in XML

Next, create a config.xml file for your module and define the layout update to rewrite the original block with your custom one. This is where you specify which carriers to hide.

<layout>
    <checkout_onepage_shipping_method_available>
        <reference name="root">
            <action method="setTemplate">
                <template> checkout/onepage/shipping/methods.phtml </template>
            </action>
        </reference>
        <update handle="checkout_shipping_method_*"/>
    </checkout_onepage_shipping_method_available>
</layout>

In this example, checkout_shipping_method_* is a wildcard that matches any shipping method block. You can replace it with the specific carrier code you want to remove (e.g., checkout_shipping_method_fixed).

Step 4: Apply Layout Updates

Finally, in your module’s config.xml, apply the layout updates using the <layout> node:

<config>
    <modules>
        <YOUR_VENDOR_ModuleName>
            <version>1.0.0</version>
        </YOUR_VENDOR_ModuleName>
    </modules>

    <layout>
        <updates>
            <your_vendor_module>
                <file>checkout.xml</file>
            </your_vendor_module>
        </updates>
    </layout>
</config>

Conclusion

Hiding specific shipping methods in Magento is a common requirement, especially for extensions that need to maintain flexibility without touching core templates. By using XML configuration and custom blocks, you can achieve this without any code changes in the frontend.

Remember to replace YOUR_VENDOR with your actual vendor name and ModuleName with your module’s name throughout the examples.

This approach ensures your extension remains compatible with future Magento versions and maintains a clean separation of concerns. If you have any questions or need further clarification, feel free to leave a comment below!

Check out our other tutorials on Magento development best practices at Laravel Company for more insights into building robust Magento extensions.

Happy coding!

Checkout API Extensions Themes

Our network