Skip to content

Newsletter subscription does not set the correct store_id if already subscribed. Not Fixed in 2.3-dev #19172

Closed
@bbmxxc

Description

@bbmxxc

Regarding #19131.
I (again) tried it on 2.3-dev an the issue is not fixed in 2.3-dev.

Preconditions (*)

  1. latest Magento Version 2.3-dev
  2. Have at least two stores ( A and B)

Steps to reproduce (*)

  1. Register a user in A
  2. Subscribe to Newsletter in A
  3. Switch to Store B
  4. Subscribe to Newsletter again

Expected result (*)

  1. When in store B, Subscriber::loadByEmail() should work
    2. SELECT store_id, customer_id FROM newsletter_subscriber should look like this:
+----------+-------------+
| store_id | customer_id |
+----------+-------------+
|        1 |           1 |
|        2 |           1 |

Actual result (*)

  1. When in store B, loadByEmail() (or loadById() ) cant find the subscriber since
  2. SELECT store_id, customer_id FROM newsletter_subscriber looks like this:
+----------+-------------+
| store_id | customer_id |
+----------+-------------+
|        1 |           1 |
|        1 |           1 |

What i think where the error is

In app/code/Magento/Newsletter/Model/Subscriber.php starting on line 468:
If the subscriber already exists with this email, the new entry gets the $customer->getStoreId()
not the $this->_storeManager->getStore()->getId()

If this is the intended behavior then loadByEmail() or loadByCustomerId() should be store_id agnostic.

Cheers!
Ben

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: NewsletterFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions