-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Atomatewoo opt-in Sync #5603
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@puntope Thanks for the pull request! The code looks perfectly fine to me, simply from the implementation side, I could approve the changes.
However, I'm wondering about the product side of this. Could you, please, clarify the reason for these changes? I'm only asking because I'm not sure whether we're generally allowed to sync subscription status for AutomateWoo when someone subscribes on the MailPoet side.
Legally, we're required to ask for user consent for each type of email, and sending something different from what the user agreed to could be considered spam.
Since we're listening to SubscriberEntity::HOOK_SUBSCRIBER_STATUS_CHANGED
here, it appears that this would result in users subscribing to any list would also be given consent on the AutomateWoo side. I think that might be problematic. Maybe we'll need to check for subscription status in the WooCommerce
list on our side, or something like that, although we don't seem to sync unsubscribes from that list (only the global ones).
I think @brezocordero and @websupporter might know more about the original implementation and the desired behavior, so I will check with them.
The context for this is a ticket. For what I see in the ticket 8195586-zen Basically when the user subscribes in Mailpoet and confirms the email. The AW opt-in is not updated directly. The user needs to go to communication preferences and then the sync is happening. Notice we do the sync in the status in previous implementations when checking if a user is unsubscribed. So In practice. The result in this PR is the same. But without the need to go to communication preferences. This is what I can give from my side. As I'm not familiar with the product. I will be waiting for Mailpoet discussion about it. Let me know if I can help with something. |
@puntope Thanks for the details. If we're currently syncing |
Can you elaborate this? Not super familiar with mailpoet so maybe I'm missing some bits. |
@puntope What we need to sync with AutomateWoo is "WooCommerce checkout opt-in/opt-out", a feature for customers of a WooCommerce shop. If we'd sync any different opt-in/opt-out flags, that would be wrong. For instance, if you subscribe to receive my blog articles via email, then we are not supposed (and allowed) to send WooCommerce related emails from either of MailPoet and AutomateWoo. |
This seems working. But also the subscriber can opt-in (to WooCommerce list) via the subscribe form. Which seems not working. (see in the ticket 8195586-zd-a8c) I guess the part missing is that I need to check that besides Subscribed status is subscribed. The subscribed list is WooCommerce? |
If my understanding is correct product-wise (I will verify with the team), then yes, this is correct, and in addition to that, we'll need to listen to
I hope that makes sense. |
HI @JanJakes I updated the code with your suggestions. However I have 2 issues I don't know how to solve:
Thanks in advance |
22fb4ac
to
2be55de
Compare
2be55de
to
2dd36fa
Compare
deb3c3f
to
cda0785
Compare
Hi @puntope, sorry for the delays, we sorted out the desired behavior and I finally got to this. I rebased this on latest I'll move it on for another code review, given that I touched the code as well, and then we will proceed merging & releasing this. One important thing to note here is that if AutomateWoo itself synchronizes the opt-in/opt-out in any way, it will need to respect the WooCommerce list subscription in the same way as implemented here. That is: if ($subscriber->getStatus() === SubscriberEntity::STATUS_SUBSCRIBED && $subscribedInWooCommerceList) {
// opt-in
} else {
// opt-out
} Thanks a lot for your contribution! 👏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, nothing to add on my end.
I haven't tested it manually, I will let QA do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GJ!
Description
This PR fixes/implements the Opt-in sync between MailPoet and AW
Currently, the Checkout implements already a compatibility between the two plugins. Also, we do full sync when the user is Unsubscribed.
However, when it subscribes via newsletter it doesn't get Opted In under AutomateWoo
Code review notes
How to test this PR:
Tasks