0

I'm writing a small plugin that intercepts the Subscriber class (Magento\Newsletter\Model\Subscriber), fetches the subscriber email address/id and pushes it further to our api.

This works well when the 'Need to Confirm' option is set to 'No'. However, when I enable the double opt-in and the confirmation email is sent and clicked, Magento completely ignores the 'SubscriberPlugin' file, even though it still actually uses the main, original class 'Subscriber' (proved by placing error_log(FILE) in the original class file).

I know that when a user clicks the confirmation link, the method triggered in the Subscriber class is confirm. With that knowledge I've added a new method afterConfirm to the SubscriberPlugin file, but that for now will do nothing, as like mentioned above, Magento is ignoring the plugin file when a user confirms subscription.

Any ideas?

0

Ok, got it working. All I needed to do was to remove the contents of the /generated/ folder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.