User guide

Abandoned Cart for Magento 2: User Guide

Up to three reminder emails for shoppers who leave items in their basket, with the basket contents, a signed link that restores it, an optional single-use coupon and an unsubscribe link.

  • Version 2.1.1
  • Magento 2.4.6 to 2.4.9
  • PHP 8.2 to 8.5
  • Hyvä and Luma

Send up to three reminder emails to shoppers who leave items in their basket. Each email shows the basket contents, a signed link that restores the basket, an optional single-use coupon and an unsubscribe link. This guide covers installation, configuration and day-to-day use.

Reminder email with the basket contents
Reminder email with the basket contents

1. Requirements

MagentoOpen Source or Adobe Commerce 2.4.6 to 2.4.9
PHP8.2 to 8.5 (Magento 2.4.6: PHP 8.2)
ThemesLuma, Blank and themes based on them; Hyvä (unsubscribe page template included)
Checkout captureLuma checkout, and Hyvä's Luma checkout fallback
Othercommercegears/module-core (installed automatically), Magento cron running

One-click List-Unsubscribe headers need Magento 2.4.8 or later; on 2.4.6 and 2.4.7 the emails are sent without them and the unsubscribe link in the email still works.

2. Installation

With Composer. Use the Composer keys from your account on commercegears.com (see https://commercegears.com/composer-access/):

composer config repositories.commercegears composer https://repo.commercegears.com
composer config --auth http-basic.repo.commercegears.com PUBLIC_KEY PRIVATE_KEY
composer require commercegears/module-abandoned-cart
bin/magento setup:upgrade
bin/magento setup:di:compile            # production mode only
bin/magento setup:static-content:deploy # production mode only
bin/magento cache:flush

To update later: composer update commercegears/module-abandoned-cart, then the same bin/magento commands.

The module is installed switched off. Nothing is tracked or sent until you set Enabled to Yes.

3. Quick start

  1. Go to Stores > Configuration > CommerceGears > Abandoned Cart Reminders (or CommerceGears > Abandoned Cart Reminders > Configuration).
  2. Under General, set Enabled to Yes and choose Send Reminders To.
  3. Optional: create a cart price rule for the coupon (see section 5) and choose it under Reminder 2 or Reminder 3 > Unique Coupon From Cart Price Rule.
  4. Open CommerceGears > Abandoned Cart Reminders > Send Test Email, send a test to yourself or click Preview in New Tab.
  5. Make sure Magento cron runs. The job commercegears_abandoned_cart_process runs every 5 minutes, records abandoned carts and sends one batch of due reminders.

4. Settings

All settings are under Stores > Configuration > CommerceGears > Abandoned Cart Reminders. The scope of each field is shown next to it.

General

SettingWhat it does
EnabledSwitches the module on or off for the scope. When off, carts are not tracked and no reminders are sent. Default: No.
Cart Counts as Abandoned After (minutes)Minutes since the cart was last changed. No reminder is sent while a cart is still being changed. Default: 60.
Ignore Carts Older Than (days)Carts last changed before this are never picked up. Default: 7.
Exclude Store ViewsCarts from these store views are never reminded.
Exclude Customer GroupsCustomers in these groups are never reminded, for example Wholesale. NOT LOGGED IN excludes guests.
Minimum SubtotalIn the base currency. Leave empty for no minimum.
Send Reminders ToEveryone with a known email address or Newsletter subscribers only. Each reminder can override this. People who used the unsubscribe link are always skipped.
Capture Guest Email FromCheckout email field, Newsletter sign-up form, Sign-in forms (email typed by a guest). Guests are only reminded when an address was captured from one of these.
Email SenderThe store email identity the reminders are sent from. Default: General Contact.

Reminder 1, Reminder 2, Reminder 3

SettingWhat it does
Send Reminder NSwitches this reminder on or off. Default: Yes.
Send ToUse General Setting (default), Everyone with a known email address or Newsletter subscribers only. People outside the audience skip this reminder and still get the later ones. Newsletter status is checked when the reminder is due.
Send After (hours)Hours after the cart was last changed. Defaults: 1, 24 and 72. Decimals are allowed (0.5 = 30 minutes). Use a larger value for each later reminder.
Email Template"Abandoned Cart: Reminder N" by default, or your own copy from Marketing > Email Templates.
Unique Coupon From Cart Price RuleOptional. Each email gets its own single-use code from the rule.
Coupon Valid For (days)Unused codes are deleted after this. The rule's own end date still applies. Default: 3.
Reminder 2 settings
Reminder 2 settings

Coupon Codes

SettingWhat it does
Code PrefixDefault: CART-. Codes look like CART-7KQ2M9XA.
Code Length (without prefix)6 to 32 characters. Default: 8.
Apply Coupon When the Cart Is RestoredThe code from the email is applied when the customer follows the restore link. Default: Yes.
SettingWhat it does
Restore Link Valid For (days)Counted from when the email was sent. Default: 14. Unsubscribe links do not expire.
Track OpensAdds a 1x1 tracking image. Open counts are an estimate, because many mail apps block or preload images. Default: Yes.
Count as Recovered Within (days)An order counts as recovered if it is placed from the reminded cart, or by the same email address within this many days of the last reminder. Default: 7.

Advanced

SettingWhat it does
Emails per Cron RunDefault: 100. Remaining reminders are sent on the next run.
Keep a Copy of Each Email in the Mail LogLets you open exactly what was sent ("View Email"). Default: No.
Delete History After (days)Cart records and mail log entries older than this are deleted, and leave the report. Default: 365.

5. Coupons

  1. Go to Marketing > Cart Price Rules > Add New Rule.
  2. Set the discount you want, Coupon = Specific Coupon and tick Use Auto Generation. Save.
  3. Choose the rule under Reminder N > Unique Coupon From Cart Price Rule. Only rules set up this way are listed.

Each email gets its own code with usage limit 1. If the same address still has an unused code from the same rule that is valid for at least another day, that code is sent again instead of a new one, and the mail log says so. Unused expired codes are deleted by the hourly cron job commercegears_abandoned_cart_cleanup. To limit discounts for signed-in customers further, set "Uses per Customer" on the rule.

6. What your customers see

The reminder email greets the customer by first name when it is known and lists the cart items with image, name, chosen options, quantity and price, the subtotal, the coupon box when a code was generated, a button back to the basket and a "Stop basket reminders" link. The three default templates have different subjects and wording, for example "You left something in your basket at (store name)" for the first reminder.

Reminder 2 with a coupon code
Reminder 2 with a coupon code

The restore link works like this:

  • In the browser that still holds the guest cart, the cart is simply reopened.
  • In any other browser, the items (and the coupon) are copied into that browser's own cart. The original cart never moves to another session.
  • A customer cart is never opened without signing in: the customer is asked to sign in and lands in their cart.
  • The mini cart shows the restored basket straight away (Luma and Hyvä).

The unsubscribe page asks the shopper to confirm. Opening the link alone does not unsubscribe, because mail scanners open links. Customers can switch reminders back on from the same page. Unsubscribing from basket reminders does not change the newsletter subscription, and the other way round. An altered or incomplete link shows a short "not valid" message (HTTP status 404).

LumaHyvä (mobile)
Unsubscribe page on LumaUnsubscribe page on Hyvä

7. Who gets a reminder

A reminder is sent when all of these are true:

  • the store view is enabled and not excluded, the customer group is not excluded and the subtotal reaches the minimum;
  • the email address is known and has not used the unsubscribe link on that website;
  • the reminder's audience includes the address (newsletter status is read when the reminder is due);
  • this is the most recently changed cart of the address on the website. Older carts show "A newer basket for this email address is being reminded", and reminders for different carts of one address are at least 24 hours apart.

A reminder that is not for the address is skipped (mail log status "Skipped", note "Not a newsletter subscriber") and the cart moves on to the next one. "Send Next Reminder Now" in the admin is not limited by the 24-hour rule.

8. Admin tools

All under CommerceGears > Abandoned Cart Reminders.

  • Abandoned Carts: customer, items, subtotal, last change, reminder stage, last and next reminder, which reminder is next and who it goes to, status with reason, and the order when there is one. Row actions: Preview Email, Send Next Reminder Now, Stop Reminders. Mass actions: Send Next Reminder Now, Stop Reminders, Delete Records. Run Now runs the cron job straight away. Opens, Clicks, Store View, Recovered Revenue and the "who it goes to" text are under Columns.
  • Mail Log: every email with status (Sent, Failed, Skipped), notes, coupon, opens, clicks and whether it led to an order. With "Keep a Copy of Each Email" on, View Email shows the stored copy.
  • Recovery Report: abandoned and reminded carts, emails sent, opened and clicked, recovered carts, recovery rate and recovered revenue by day, week or month, per store view, with totals and a chart.
  • Send Test Email: any address, any reminder, a sample cart from the catalogue or a tracked cart, and Preview in New Tab. No real coupon is generated and the cart is not changed.
Abandoned Carts grid
Abandoned Carts grid
Send Test Email page
Send Test Email page

9. Command line

bin/magento commercegears:abandoned-cart:run [--collect-only] [--send-only] [--dry-run] [--limit=N]
bin/magento commercegears:abandoned-cart:preview [--cart=ID] [--store=ID] [--reminder=1|2|3] [--output=file.html]
bin/magento commercegears:abandoned-cart:test <email> [--cart=ID] [--store=ID] [--reminder=1|2|3]
bin/magento commercegears:abandoned-cart:stats [--from=Y-m-d] [--to=Y-m-d] [--period=day|week|month] [--store=ID]
bin/magento commercegears:abandoned-cart:unsubscribe <email> [--website=ID|code] [--remove]
bin/magento commercegears:abandoned-cart:unsubscribe --list [<email>] [--website=ID|code]
  • run does what the cron job does; --dry-run lists the reminders that would be sent.
  • preview renders a reminder without sending it; test sends one to an address (logged as a test).
  • stats prints the report figures by period.
  • unsubscribe adds an address to the opt-out list (all websites unless --website is given) and stops its open reminders, for example when a customer asks by phone; --remove allows reminders again.

10. Permissions (ACL)

Under System > Permissions > User Roles > Role Resources > CommerceGears > Abandoned Cart Reminders:

ResourceAllows
Abandoned CartsThe Abandoned Carts grid and email preview
Send Reminders and Test EmailsSend Next Reminder Now, Run Now, Send Test Email
Stop and DeleteStop Reminders, Delete Records and deleting Mail Log entries
Mail LogThe Mail Log
Recovery ReportThe Recovery Report
Abandoned Cart ConfigurationThe configuration section

11. Privacy (GDPR)

  • Guest addresses are stored on the guest's own cart record only.
  • When a customer account is deleted, its abandoned cart records and mail log entries are deleted too.
  • Carts that were never emailed are deleted after 30 days (or after "Ignore Carts Older Than", if longer); everything else after "Delete History After". The unsubscribe list is kept, so unsubscribed addresses stay unsubscribed.
  • Choose "Send Reminders To" according to your local rules on marketing email, and mention basket reminders in your privacy policy.

12. Troubleshooting

ProblemSolution
No carts appear in the gridCheck General > Enabled for the store view, that cron runs, and that the cart is idle for longer than "Cart Counts as Abandoned After". Guests need a captured email address. Click Run Now to run the job straight away.
A cart shows "Not eligible"The status note gives the reason, for example the subtotal is below the minimum, the address is not a newsletter subscriber, or a newer basket for the address is being reminded.
Emails are logged but not receivedWith "Disable Email Communications" on (Stores > Configuration > Advanced > System), emails are rendered and logged with a note but not delivered. Otherwise check your mail transport.
No coupon in the emailThe rule must have Coupon = Specific Coupon and "Use Auto Generation", be active and not expired. The mail log notes why a code was not generated.
A restore link says it has expiredLinks are valid for "Restore Link Valid For" days after sending. Rotating the store's crypt key also invalidates links already sent.
Guest emails are not captured on a custom checkoutThe checkout capture supports the Luma checkout. Other checkouts need a small integration that posts the address to abandonedcart/capture/email.
Report revenue looks mixedRecovered revenue is summed in each order's base currency; with several base currencies the total mixes them.

13. Uninstall

bin/magento module:disable CommerceGears_AbandonedCart
composer remove commercegears/module-abandoned-cart
bin/magento setup:upgrade
bin/magento cache:flush

The tables commercegears_abandoned_cart, commercegears_abandoned_cart_log and commercegears_abandoned_cart_unsubscribe stay in the database until you drop them. Generated coupon codes stay on their cart price rules.

This guide is for version 2.1.1 and also comes with the module, in docs/user-guide.md. All user guides