How to remove Newsletter subscription panel from Magento 2.x
There are few cases you may want to remove the default Newsletter subscription panel from Magento web site. But unfortunately there is no configuration settings that can easily performed from Magento admin for Newsletter removal. However it is not a big job where you can do it from your SSH Console or from the layout.xml
Remove using the Layout.xml (recommended)
We recommend this method because your Newsletter module may depend on other modules or vice-versa which may cause dependency issues.
- Go to vendor/magento/module-newsletter/view/frontend/layout Directory.
- Edit the file default.xml.
- Add below code under <page><body>
<referenceBlock name="form.subscribe" remove="true"/>
IE: Refer the image below.
- Now clear your Magento cache, browser cache and look at the Magento website. You see the Subscribe Newsletter panel is hidden.
Removing from Account creation page
The above steps will remove the Newsletter subscription panel from footer. If you also like to remove it from account creation page then follow few additional steps below.
- Go to the directory “vendor/magento/module-customer/view/frontend/templates/form”
- Open the file “register.phtml”
- Search for “Newsletter”, you will land into the Div block for the Newsletter subscription.
- Just remove the entire div as highlighted in below image.
- Flush Magento cache from your Magento admin.
- Make a hard refresh or clear cache in your browser. You can see the option is removed.
Remove using Console
This method removes the Newsletter option totally from footer, account creation and anywhere else.
- Login to your server via SSH console.
- Make sure the user you logged in has access to bin/magento folder of your website directory.
- Type below commands one by one.
$ php bin/magentomodule:disable --clear-static-content $ Magento_Newsletter $ php bin/magentosetup:upgrade $ php bin/magentocache:clear
- Now clear your browser cache and look on your Magento website where you can observe Newsletter subscription module is gone.