Knowledge blog

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.

  1.  Go to vendor/magento/module-newsletter/view/frontend/layout Directory.
  2.  Edit the file default.xml.
  3.  Add below code under <page><body>
<referenceBlock name="form.subscribe" remove="true"/>

IE: Refer the image below.

  1.  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.

  1.  Go to the directory “vendor/magento/module-customer/view/frontend/templates/form”
  2.  Open the file “register.phtml”
  3.  Search for “Newsletter”, you will land into the Div block for the Newsletter subscription.
  4.  Just remove the entire div as highlighted in below image.
  1. Flush Magento cache from your Magento admin.
  2. 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.

  1. Login to your server via SSH console.
  2. Make sure the user you logged in has access to bin/magento folder of your website directory.
  3. Type below commands one by one.
php bin/magentomodule:disable --clear-static-contentMagento_Newsletterphp bin/magentosetup:upgradephp bin/magentocache:clear
  1. Now clear your browser cache and look on your Magento website where you can observe Newsletter subscription module is gone.
Note: You may end up with dependency errors. In this case you need to remove the dependencies before disabling this module. That is why it is preferred to go with the Method 1.