klaviyo / magento2-klaviyo

37 stars 51 forks source link

Fix the issue with a newsletter subscription #56

Closed iGerchak closed 3 years ago

iGerchak commented 4 years ago

Issue: When adding a new newsletter to Magento via custom module, Observer NewsletterSubscribeObserver not called, but after saving newsletter to the Magento calls another Observer UserProfileNewsletterSubscribeObserver and try to get a customer by ID, Magento throws Exception because a customer with ID=0 doesn't exist. As a result, an event about a new newsletter doesn't send to Klaviyo.

Related issue: #19

Steps to reproduce:

  1. Configure "Welcome email" in the Klaviyo
  2. Create a new module for subscribe newsletter programmatically: https://magento.stackexchange.com/questions/150252/how-to-create-newsletter-subscriber-programmatically-magento2
  3. Try to subscribe to a newsletter.

Expected result: Email what was subscribed should get "Welcome email"

Actual result: "Welcome email" doesn't send

ihor-sviziev commented 4 years ago

@remstone7 could you look at this PR?