setono/sylius-abandoned-cart-plugin

Reengage customers who abandoned their cart in Sylius

Fund package maintenance!
Setono

Installs: 20 960

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 1

Forks: 4

Open Issues: 4

Type:sylius-plugin

pkg:composer/setono/sylius-abandoned-cart-plugin

This package is auto-updated.

Last update: 2026-02-25 13:15:52 UTC


README

Latest Stable Version Total Downloads License PHP Version Require build codecov Mutation testing badge

Installation

composer require setono/sylius-abandoned-cart-plugin

Add bundle to config/bundles.php

Make sure you add it before SyliusGridBundle, otherwise you'll get You have requested a non-existent parameter "setono_sylius_abandoned_cart.model.notification.class". exception.

<?php
// config/bundles.php

return [
    // ...
    Setono\SyliusAbandonedCartPlugin\SetonoSyliusAbandonedCartPlugin::class => ['all' => true],
    Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true],
    // ...
];

Configure plugin

# config/packages/setono_sylius_abandoned_cart.yaml
setono_sylius_abandoned_cart:
    # A secret salt used to generate secure unsubscribe URL hashes (SHA256). Change this in production.
    salt: your_secret_salt

Configure routes

# config/routes/setono_sylius_abandoned_cart.yaml
setono_sylius_abandoned_cart:
    resource: "@SetonoSyliusAbandonedCartPlugin/Resources/config/routes.yaml"

Install assets

bin/console assets:install

Update your schema

# Generate and edit migration
bin/console doctrine:migrations:diff

# Then apply migration
bin/console doctrine:migrations:migrate

Add cronjobs

The plugin requires two commands to run on a regular basis:

# Create notifications for idle carts (should run frequently, e.g., every 5 minutes)
bin/console setono:sylius-abandoned-cart:create-notifications

# Process pending notifications and send emails
bin/console setono:sylius-abandoned-cart:process-notifications

The create-notifications command finds carts that have been idle for the configured threshold and creates notification records for them. The process-notifications command then sends the actual emails.

You can test the create-notifications command without persisting anything:

bin/console setono:sylius-abandoned-cart:create-notifications --dry-run

To clean up old notifications, run the prune command (e.g., daily):

bin/console setono:sylius-abandoned-cart:prune-notifications

Configuration options

# config/packages/setono_sylius_abandoned_cart.yaml
setono_sylius_abandoned_cart:
    salt: your_secret_salt

    # Minutes before a cart is considered idle (default: 60)
    idle_threshold: 60

    # Lookback window in minutes - only carts that became idle within this window
    # will be selected for notification creation. This limits the number of
    # notifications created per command run. (default: 15)
    # Important: Run the create-notifications command more frequently than this value
    lookback_window: 15

    # Prune notifications older than this many minutes (default: 43200 = 30 days)
    prune_older_than: 43200

    eligibility_checkers:
        # Skip customers who actively unsubscribed (default: true)
        unsubscribed_customer: true

        # Only notify customers subscribed to the newsletter (default: false)
        subscribed_to_newsletter: false