Reputation: 175
I want to show a custom message if user already subscribed with a email address. like
You are already subscribed. Thank you.
Instead of this message.
I am using magento2.1.8.
Upvotes: 0
Views: 1119
Reputation: 101
You need to modify this simple checking.
Try this -
Go to this path if you haven't override NewAction.php
file yet vendor\magento\module-newsletter\Controller\Subscriber
and open NewAction.php
file.
Replace this code:
if ($subscriber->getId() && $subscriber->getSubscriberStatus() == \Magento\Newsletter\Model\Subscriber::STATUS_SUBSCRIBED)
With:
if($subscriber->getId())
That's all.
Upvotes: 0
Reputation: 216
You should define a preference (via di.xml) for the OOTB Controller that handles the Subscription sign-up process (Magento/Newsletter/Controller/Subscriber/NewAction.php) and in your custom controller's execute method - add the desired logic to check whether/not the customer has already subscribed and handle it accordingly.
Upvotes: 1