AI-Powered Cart Recovery Assistant for Magento 2
Smart abandoned cart recovery
AI Cart Recovery Assistant for Magento 2 helps stores recover incomplete orders more effectively without manually managing follow-up campaigns. The module automatically detects active carts that have not been updated for the period defined in the configuration, then saves them as potentially abandoned.
The next step is to assess the customer purchase intent. The module can analyze the cart using OpenAI or, if AI integration is not enabled, use a secure heuristic mechanism. It considers factors such as cart value, number of products, checkout stage, and basic customer context. Based on this, an intent score is calculated, meaning the likelihood of completing the purchase, along with the abandonment reason, such as price sensitivity, checkout friction, or offer comparison.
Personalized emails that recover sales
After the minimum intent threshold is exceeded, the module generates cart recovery emails. The content can be prepared by AI based on the cart contents and the detected abandonment reason, or by a fallback mechanism based on ready-made messages. The message includes a secure link to restore the cart and, optionally, a link to the AI assistant, which can answer customer questions and help them complete the purchase.
The module stores sending logs, supports a failed attempt counter, and lets you control the maximum number of errors. As a result, the process is automated while remaining predictable and easy for the store team to monitor.
Dynamic discount coupons
For carts with lower purchase intent and an appropriate order value, the module can automatically generate a one-time discount code. The discount amount is calculated based on cart value and intent score, while the maximum discount limit remains fully under the administrator control. This helps protect margin more effectively and trigger a discount only when it makes real business sense.
AI assistant for the customer
One of the module key differentiators is the built-in AI assistant connected to the abandoned cart. The customer can open a dedicated link and ask a question about products, variant selection, or purchase benefits. The module passes the cart context, product information, and even data about related, upsell, and cross-sell products to the AI model. Conversations are saved in the admin panel, giving the team insight into real customer purchase objections.
Dashboard, analytics, and technical integration
In the Magento panel, the administrator gets access to the Dashboard, Recovery Analytics, Conversations, and Email Logs sections. The module marks recovered carts after an order is placed and presents basic metrics, such as the number of abandoned carts, number of recovered carts, recovered revenue, number of emails sent, and coupon usage.
For more advanced implementations, CLI commands and REST API endpoints are available. The module runs cron jobs for cart detection, scoring, and email sending, making it a good fit for the standard Magento 2 automation architecture.
Key benefits
- automatic abandoned cart detection
- cart scoring using AI or heuristic logic
- personalized emails that recover sales
- secure one-click cart restoration
- optional generation of one-time discount coupons
- AI assistant that helps customers complete the purchase
- dashboard, analytics, email logs, and conversation history
- REST API and CLI for integration with store processes
- per-store configuration and Magento 2 compatibility
Magento 2 module for recovering abandoned carts with features for:
- detecting abandoned carts
- cart scoring using AI or heuristics
- generating cart recovery emails
- optional coupon generation
- conversations with an AI shopping assistant
- admin panel and analytics
- REST API endpoints and CLI commands
Overview
The module helps recover abandoned carts in Magento 2 by detecting inactive carts, evaluating purchase intent, and sending emails with a secure link to restore the cart. Depending on the configuration, it can operate in two modes:
heuristicmode, without external AIOpenAImode, with AI analysis, email content generation, and assistant conversations
Typical workflow:
- The customer adds products to the cart.
- The customer leaves the store without placing an order.
- After the configured inactivity period passes, the cart is marked as abandoned.
- The module assigns a score to the cart.
- If the score is high enough, a recovery email is sent.
- The email may include a discount coupon and a link to the AI assistant page.
- If the customer returns and places an order, the cart is marked as recovered.
Requirements
Before installation, make sure the store meets the following requirements:
- Magento 2 with CLI access
- properly working Magento cron
- transactional email sending configured in Magento
- HTTPS enabled on the storefront
- if AI mode is used: OpenAI API account with active billing and an API key
Operational recommendations:
- production mode for the live store
- tested email template and correctly configured sender
- privacy policy covering the use of AI services if OpenAI mode is enabled
Installation
* = on production, use the --keep-generated option
Type: Composer
Add the Composer repository to the configuration:
composer config repositories.ai.abandoned.cart vcs https://github.com/kowalco/ai-abandoned-cartAdd an access token for the private GitHub repository:
composer config --global --auth github-oauth.github.com Install the module via Composer:
composer require kowal/module-ai-abandoned-cart
Then run:
bin/magento module:enable Kowal_AiAbandonedCartbin/magento setup:upgradebin/magento setup:di:compilebin/magento cache:flushPost-installation checklist
After installation, check:
- whether the module is enabled in Magento
- whether the database schema was installed by
setup:upgrade - whether Magento cron is working correctly
- whether the store sends transactional emails
- whether the storefront uses valid HTTPS URLs
Useful verification commands:
bin/magento module:status Kowal_AiAbandonedCartbin/magento cron:runbin/magento cache:flushConfiguration
Magento Admin:
Stores -> Configuration -> Kowal -> AI Abandoned Cart
Admin pages:
Marketing -> AI Abandoned Cart
Configuration fields
Key settings:
Enable ModuleEnables or disables the entire module.Cart Inactivity Threshold (minutes)Defines after how many minutes of inactivity an active cart should be considered abandoned.AI ProviderAvailable values:Heuristic FallbackOpenAI
OpenAI API KeyRequired only whenAI Provideris set toOpenAI.Minimum Intent ScoreOnly carts with a score equal to or higher than this value qualify for sending a recovery email.Enable Dynamic CouponsEnables generation of one-time coupons for selected abandoned carts.Maximum Coupon DiscountDefines the upper limit of the automatically generated percentage discount.Maximum Failed Email AttemptsDefines how many failed sending attempts are allowed before the module stops retrying.Email Address for Message CopiesOptional BCC recipient for recovery messages.Enable AI Assistant LinkIf enabled, the recovery email will include a secure link to the AI assistant page.Conversation Expiration Time (minutes)Defines how long the AI assistant link remains valid.Batch SizeDefines how many carts are processed in one detection, scoring, and email sending run.Cart Analysis PromptUsed when AI scoring is active.Email Generation PromptUsed to generate email content in AI mode.Conversation PromptUsed by the AI assistant during a conversation with the customer.
Recommended initial configuration
A safe starting set of settings is:
Enable Module:YesCart Inactivity Threshold (minutes):30AI Provider:Heuristic FallbackorOpenAIMinimum Intent Score:0.45Enable Dynamic Coupons:YesMaximum Coupon Discount:5Maximum Failed Email Attempts:3Enable AI Assistant Link:YesConversation Expiration Time (minutes):1440Batch Size:100
Heuristic mode vs OpenAI mode
Heuristic mode
Use this mode if you want to start without integrating with external AI.
In this mode, the module:
- detects abandoned carts
- calculates intent score based on built-in business rules
- sends recovery emails
- can generate coupons
- can still provide the assistant page, but responses will be based on built-in logic instead of OpenAI
OpenAI mode
Use this mode if you want greater personalization.
In this mode, the module can additionally:
- analyze cart context using OpenAI
- generate more personalized email content
- handle AI assistant conversations about products in the cart
- use product descriptions, related products, up-sell, and cross-sell in responses
OpenAI configuration
To enable OpenAI mode:
- Create an API key in your OpenAI Platform account.
- In Magento Admin, go to
Stores -> Configuration -> Kowal -> AI Abandoned Cart. - Set
AI ProvidertoOpenAI. - Paste the key into the
OpenAI API Keyfield. - Save the configuration.
- Clear the Magento cache.
Important information:
- ChatGPT subscriptions and API billing are separate things
- API usage is billed independently by OpenAI
- in AI mode, the prompt and cart context are sent to OpenAI
Cron Jobs
The module uses Magento cron jobs for automatic processing.
Configured cron jobs:
kowal_ai_abandoned_cart_detectkowal_ai_abandoned_cart_scorekowal_ai_abandoned_cart_email
What they do:
detect: finds inactive carts that qualify as abandonedscore: calculates intent score and reason codeemail: sends recovery emails and saves logs
If Magento cron is not working, the module will not automatically process carts.
First test after configuration
After installation and configuration, perform a full end-to-end test:
- Open the storefront as a guest customer.
- Add one or more products to the cart.
- Start checkout and enter an email address.
- Leave checkout without placing an order.
- Wait until the configured inactivity threshold has passed.
- Run cron or CLI commands manually.
- Confirm that the cart appeared in the admin panel.
- Confirm that the recovery email was sent.
- Open the cart restore link from the message.
- If the option is enabled, open the AI assistant link and send a test message.
Manual CLI sequence:
bin/magento kowal:ai:cart:detectbin/magento kowal:ai:cart:scorebin/magento kowal:ai:cart:send-emailsAdmin pages
The module adds dedicated admin pages under:
Marketing -> AI Abandoned Cart
Available sections:
DashboardOverview of detected and recovered carts.Recovery AnalyticsRecovery performance statistics and operational metrics.ConversationsHistory of AI assistant conversations linked to abandoned carts.Email LogsLog of sent and failed recovery messages.
These pages are especially useful during implementation because they let you verify whether detection, scoring, email sending, and recovered cart tracking are working correctly.
Email content and customer experience
Each recovery email can include:
- a personalized subject line
- custom message content
- a summary of products in the cart
- cart value
- a secure link to restore the cart
- an optional one-time discount coupon
- an optional link to the AI assistant
Customer journey:
- The customer receives an email.
- The customer clicks the restore link and returns to the saved cart.
- The customer can optionally open the assistant page from the message.
- The assistant can answer product questions, compare options, and guide the customer back to checkout.
How coupons work
If dynamic coupons are enabled, the module can generate a coupon when:
- the cart value is high enough
- the intent score suggests that a discount may help
- the calculated discount does not exceed the configured maximum
Current built-in rules:
- carts below 100 store currency units do not receive a coupon
- carts with a high intent score do not receive a coupon
- carts with lower intent may receive a discount, usually 3% or 5%, limited by the configuration
Generated coupons are:
- one-time use
- limited per customer
- linked to a shared Magento cart rule for the given discount level and store
CLI
You can run the module manually from the CLI, especially during testing and diagnostics.
bin/magento kowal:ai:cart:detectbin/magento kowal:ai:cart:scorebin/magento kowal:ai:cart:send-emailsCommand meaning:
kowal:ai:cart:detectDetects abandoned carts.kowal:ai:cart:scoreAssigns scoring and a reason code to carts.kowal:ai:cart:send-emailsSends recovery messages for qualifying carts.
Security
Cart restore and assistant links use signed tokens.
The token payload contains:
quote_idemailstore_idexpires_at
The token is validated by:
- signature verification
- expiration date check
- cart ownership verification
This gives the customer a secure link tied to a specific cart and limited in time.
Troubleshooting
Carts are not being detected
Check:
- whether the quote is still active
- whether the cart contains products
- whether the quote does not have a related completed order
- whether the customer email address was captured
- whether the inactivity threshold has passed
- whether Magento cron is running
Carts are detected, but emails are not being sent
Check:
- whether
Enable Moduleis enabled - whether
Minimum Intent Scoreis not set too high - whether email sending works in Magento
- whether the
Maximum Failed Email Attemptslimit has not been reached - whether the email address assigned to the cart is correct
OpenAI mode is enabled, but the AI score is not being used
Check:
- whether
AI Provideris set toOpenAI - whether
OpenAI API Keyis filled in correctly - whether the server allows outbound connections to the OpenAI API
- whether the OpenAI account has active billing
If the OpenAI call fails, the module will switch to the built-in heuristic behavior.
The AI assistant link opens, but responses are generic
Check:
- whether OpenAI mode is active
- whether the conversation prompt is configured correctly
- whether the link is still valid and has not expired
Notes for production use
Before launching in production, it is worth:
- checking email content and branding
- testing the coupon policy against real business rules
- verifying privacy and compliance requirements
- testing AI prompts on the store catalog and communication tone
- monitoring the first days of operation in
Dashboard,Conversations, andEmail Logs
Information needed for a support request
When reporting an issue, prepare:
- Magento version
- PHP version
- store mode: developer or production
- information on whether cron is running
- information on whether the issue occurs in
heuristicorOpenAImode - sample quote ID or customer email address affected by the issue
- relevant entries from Magento exception logs or system logs
Questions and Answers
At Toursport.pl, customers often abandon their cart when they hesitate between size, product use, or season: a trekking jacket, shoes for a longer route, or a backpack with the right capacity. The decision requires confidence that the product will perform well in specific conditions.
Installing Kowal AI Abandoned Cart helps recover this moment of hesitation. The module sends a personalized email, restores the cart with a single link, and directs customers to an AI assistant that helps compare variants and reduces the risk of postponing the purchase.
Tandembaits.com sells specialist accessories and bait for carp anglers, so an abandoned cart often does not mean a lack of interest, but simply a moment spent comparing a setup. The customer may be checking boilie flavors, hook sizes, or compatibility with their existing gear.
After installing the Kowal AI Abandoned Cart module, the store can automatically detect such carts, assess purchase intent, and send a message with a return link. The AI assistant helps refine the choice, and a coupon can help complete the purchase without an aggressive discount.
At PCHB.pl, carts are usually high-value, and the purchase decision takes longer. The customer may abandon the order because they return to the bathroom design, consult the tile format with the contractor, or compare Italian and Spanish collections from the premium segment.
After installation, Kowal AI Abandoned Cart works like a discreet reminder from the seller. The module identifies the cart, assigns it a score, and sends an elegant message with a secure return link. The AI assistant can help with questions about application, style, and alternative collections.
At Hobbycenter24.pl, an abandoned cart often results from the need to match the replica, magazines, battery, charger, or eye protection. The customer is interested in making a purchase, but wants to avoid an incomplete set or components that do not fit the selected model.
After implementing Kowal AI Abandoned Cart, the store can automatically remind customers about their cart and encourage them to return to the purchase. The recovery message leads to the cart and the AI assistant, which helps resolve technical doubts, and the discount can be triggered only for carts with a high score.
At Bikechill.pl, customers most often abandon their cart when comparing the type of bicycle, frame size, components, or additional accessories. The purchase is technical and seasonal, so a moment of hesitation may result from the need to confirm whether the selected model suits the route, height, and riding style.
Kowal AI Abandoned Cart helps bring them back to that decision without pressure. The module detects an abandoned cart, sends a message with a return link, and can direct the customer to an AI assistant that answers questions about fit, variants, and set components.



























