Skip to content
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

[Bug] The Abandoned Cart Automation triggers contact creation in DotDigital when it is not expected #638

Open
bohdan-harniuk opened this issue Jan 27, 2025 · 3 comments

Comments

@bohdan-harniuk
Copy link

Description

The Abandoned Cart automation in DotDigital runs every 5 minutes to check for abandoned carts across all stores, including both customer and guest carts. This automation is configured with the Enrol Abandoned Cart After option set to 15 minutes.

Currently, the query responsible for loading potentially abandoned carts does not check whether the cart is empty. This leads to unexpected behavior:

  1. When a new account is created, an empty cart is also created.
  2. Approximately 20 minutes later (based on the described settings), a new contact is created on the DotDigital side, even if no automation is enrolling this contact.

Steps to Reproduce

  1. Configure the Enrol Abandoned Cart After option to 15 minutes.
  2. Register a new account on the store.
  3. Wait for approximately 20 minutes.
  4. Check DotDigital contacts – a new contact will be created, even though the cart is empty and not eligible for Abandoned Cart automation.

Expected Behavior

A new contact should only be created if the cart is eligible for Abandoned Cart automation enrollment. Specifically:

  • Only non-empty carts should be classified as abandoned and trigger automation enrollment.

Actual Behavior

Empty carts are treated as abandoned, causing unnecessary contact creation on the DotDigital side in the enrollment process.

Technical Details

The issue stems from the following call chain:

  • \Dotdigitalgroup\Email\Model\AbandonedCart\ProgramEnrolment\Enroller::processAbandonedCartsProgramEnrolmentAutomation
  • \Dotdigitalgroup\Email\Model\AbandonedCart\ProgramEnrolment\Enroller::getStoreQuotesForGuestsAndCustomers
  • \Dotdigitalgroup\Email\Model\ResourceModel\Order\Collection::getStoreQuotesForAutomationEnrollmentGuestsAndCustomers
  • \Dotdigitalgroup\Email\Model\Apiconnector\V3\Contact\Patcher::getOrCreateContactByEmail

Proposed Solution

  • Update the loading abandoned carts query to include a check for non-empty carts.
@bohdan-harniuk bohdan-harniuk changed the title The Abandoned Cart Automation triggers contact creation in DotDigital when it is not expected [Bug] The Abandoned Cart Automation triggers contact creation in DotDigital when it is not expected Jan 27, 2025
@bohdan-harniuk
Copy link
Author

Hi, DotDigital team,

I tried to create a PR with a fix, but I don't have the necessary permissions to do so. Could you please grant me the required permissions or provide instructions on how to contribute here?

Thank you,

@sta1r
Copy link
Contributor

sta1r commented Jan 30, 2025

Hi @bohdan-harniuk please fork the repo and PR from your fork into dotmailer:develop. Thanks!

@sta1r
Copy link
Contributor

sta1r commented Jan 30, 2025

Just to pre-empt your PR a bit, the problem we have here potentially is that we need to send cart insight:

  • for contacts with active quotes containing items
  • for contacts with active quotes that did initially contain items, but have been intentionally emptied

In order to send cart insight, we need a contact to be present. A contact with cart insight is not automatically enrolled - that only happens if their quote has items, and we save them into email_automation (from where a separate cron picks them up and enrols them).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants