Hide Flatrate shipping method in frontend in Magento.

In this post, We explain how to hide flatrate shipping method in frontend in magento. Subscribe to Bnethos for all the Magento2 problems and customizations

Steps to Hide Flatrate shipping method in frontend in Magento

You can refer our create a module blog to create a custom module for this issue.

Step 1: Create a System Configuration

In this step, we will create a system configuration
Create a system.xml under app/code/Bnethos/DisableFlatrate/etc/adminhtml/system.xml. system.xml is used to create a configuration in magento admin.

The result of the system configuration files in the below image. Using this field you can hide/ show the flatrate shipping method in frontend.

Flatrate

Step 2: Create a Plugin

Create a Plugin to hide/show flatrate shipping method in the frontend. Register a plugin in di.xml under app/code/Bnethos/DisableFlatrate/etc/di.xml.

Create a new plugin Flatrate.php under app/code/Bnethos/DisableFlatrate/Plugin/Carrier/Flatrate.php

That’s it! Based on the system configuration, you can hide/show the flatrate shipping method in the frontend.

If you need more help regarding this post, feel free to ask in the Comments section below.

I would be happy to solve your queries.

7 thoughts on “Hide Flatrate shipping method in frontend in Magento.”

Leave a Comment