Skip to main content

Abandoned Cart Recovery

Overview​

The Abandoned Cart Recovery module records carts that shoppers leave without checking out and emails those shoppers a link that restores the cart, optionally with a single-use WooCommerce coupon. The follow-up runs on a schedule the store owner sets.

It is for stores that want to chase unfinished checkouts without adding an external service. Capture, scheduling, sending and cleanup all run inside the store's own WordPress installation, and the mail goes out through wp_mail.

Availability​

ItemValue
Module keyabandoned_cart
TierPremium
Entitlement keyabandoned_cart
Admin tababandoned-cart, under Marketing & Email
Enabled optionaiowc_module_enabled_abandoned_cart (off until turned on)
REST namespaceaiowc/v1

The module class is constructed at bootstrap, but it registers no hooks, no REST routes and no jobs until the module is switched on from the Modules screen, and it can only be switched on while the licence grants the abandoned_cart entitlement. Enabling it creates the three tables listed below, seeds the default settings and schedules the three background jobs. Disabling it unschedules them; the tables and their rows are left in place.

Settings​

Settings live in a single option row, aiowc_ac_settings, stored with autoload=false. Installations that predate the bundled row keep per-key options named aiowc_ac_<key>; those are migrated on the first read after the upgrade.

API nameStored keyDefaultMeaning
abandonTimeoutabandon_timeout60Minutes of inactivity after which a captured cart is treated as abandoned.
enableGuestCaptureenable_guest_capturetrueWhether the checkout script captures an address from visitors who are not signed in.
emailSequenceemail_sequence[1, 3, 7]Delays, in hours, at which each recovery email is scheduled after abandonment.
autoCouponauto_coupontrueWhether a recovery coupon is created and included in the email.
couponDiscountTypecoupon_discount_typepercentpercent creates a percentage coupon; any other value creates a fixed cart discount.
couponValuecoupon_value10Discount amount, read according to the type above.
couponExpirycoupon_expiry7Days until the generated coupon expires.
cleanupDayscleanup_days30Age in days at which unrecovered cart rows are deleted by the cleanup job.
emailFromNameemail_from_namesite titleFrom name on recovery mail.
emailFromAddressemail_from_addresssite admin emailFrom address on recovery mail.

emailSequence is written to the option as a JSON array and read back as an array. Each value is passed to strtotime() as a number of hours, so the shipped default sends at roughly 1, 3 and 7 hours after the cart is marked abandoned — not days.

Three subject lines ship with the module ("You left something behind!", "Your cart is waiting for you", "Last chance! Complete your purchase"). They are assigned by position, and a sequence longer than three entries reuses the first subject for every later message. The subjects are not configurable.

Admin screen​

The Abandoned Cart tab shows recovery statistics and the captured carts:

  • Summary figures read from GET /abandoned-carts/stats.
  • A paginated table of carts — customer, item count, cart value, time since abandonment and status — with a status filter offering all carts, abandoned, recovered, converted and expired.
  • A refresh control, and a retry control when a request fails.

The screen reads only. The settings endpoints below exist, but no control on this screen writes to them, so the shipped defaults apply unless the settings route is called directly.

REST API endpoints​

All routes sit on the aiowc/v1 namespace. "Manage" below means the caller needs manage_woocommerce, plus a valid REST nonce when the request is authenticated by cookie.

MethodPathPurposeRequired args
GET/abandoned-cartsList carts; accepts page, per_page, status.–
GET/abandoned-carts/{id}Read one cart.id
POST/abandoned-carts/captureCapture a cart and its email from the checkout.email
GET/abandoned-carts/overviewCounts for the admin overview.–
GET/abandoned-carts/statsRecovery statistics.–
GET/abandoned-carts/settingsRead the settings above.–
PUT / PATCH / POST/abandoned-carts/settingsUpdate the settings above.–
GET/abandoned-carts/track/open/{email_id}Record an email open.email_id
GET/abandoned-carts/track/click/{email_id}Record a link click.email_id

Permissions differ by route:

Route groupPermission
Everything except capture and trackingManage (manage_woocommerce).
/abandoned-carts/captureOpen to guests, but requires a REST nonce and is rate limited to 10 requests a minute.
The two /abandoned-carts/track/... routesOpen reads, rate limited to 120 requests a minute per caller.

WooCommerce integration​

HookWhat the module does
wp_enqueue_scriptsOn the checkout page only, loads assets/js/cart-capture.js and passes it the capture URL, a REST nonce, the guest-capture setting and whether the visitor is signed in.
woocommerce_checkout_order_processedRecords that the cart reached an order.
woocommerce_order_status_completedMarks the matching cart converted.
woocommerce_payment_completeMarks the matching cart converted.
template_redirectHandles an inbound recovery link.
woocommerce_applied_couponRecords use of a recovery coupon.

A recovery link carries aiowc_recover (the cart id), aiowc_t (a signature over the cart and email ids), and optionally email_id and coupon. The signature is verified before any record is loaded, because cart ids are sequential and the restore path writes the original customer's address into the current visitor's WooCommerce session. An unsigned or edited link returns without any side effect.

Coupons​

When autoCoupon is on, the module creates a real WC_Coupon with a code of the form AIOWC-XXXXXXXX, marked individual use only, usage limit 1, and with an expiry set from couponExpiry. One coupon is reused for a cart while it remains unused.

Database schema​

TableHolds
{prefix}aiowc_abandoned_cartsCaptured carts, their contents, value, customer address and status.
{prefix}aiowc_recovery_emailsScheduled and sent recovery messages with their status.
{prefix}aiowc_recovery_couponsCoupons generated for a cart, with type, value, expiry and use.

Background jobs​

All three are Action Scheduler recurring actions in the aiowc group, scheduled when the module is enabled and unscheduled when it is disabled.

HookIntervalWork
aiowc_ac_detect_abandoned15 minutesMarks captured carts abandoned once abandonTimeout has passed, and schedules the email sequence.
aiowc_ac_send_recovery_email5 minutesSends due messages. A cart that is no longer abandoned has its pending messages cancelled.
aiowc_ac_cleanup24 hoursDeletes cart rows older than cleanupDays, expired tracking rows, and expired WooCommerce coupons whose code begins AIOWC-.

Entitlement limits​

The entitlement is a single on/off grant: without abandoned_cart the module stays locked, and while it is absent none of the above loads. The licence carries no per-record quota for this module — cart, email and coupon volumes are bounded only by the settings above.

Health check​

The module reports a warning when its tables are missing or when WooCommerce is not active, and otherwise reports that it is functioning normally.