Broadleaf Microservices
  • v1.0.0-latest-prod

Abandoned Cart Purge

Overview

A scheduled job can be configured to routinely purge abandoned anonymous carts from the database.

Configuration

The PurgeAbandonedCartsJobListener listens for "PURGE_CARTS" events, then parses the job details to get the "Abandoned Cart Timeout" and a list of statuses. If a parameter is not found in the job details, a default time out of 30 day or default status "IN_PROCESS" will be used.

Job Details

Job Detail Key Type Default Value Description

purgeCartsAbandonedCartTimeout

Duration

30d

Anonymous carts that have not been updated for this amount of time are subject to removal. This is parsed with Spring’s DurationStyle, so either ISO-8601 formatting or simple formatting can be used.

purgeCartsStatus

Comma-separated list

IN_PROCESS

List of cart statuses to be purged

Example ScheduledJobs service insert

The following sql snippet would configure a job to run every day at midnight to delete carts that had not been updated in 30 days with the status "IN_PROCESS".

-- purge anonymous carts scheduled job
INSERT INTO BLC_SCHEDULED_JOB (ID, TYPE, TIMING_TYPE, NAME, ENABLED, EXECUTED, CRON,
                               MANAGE_IN_ADMIN, TRK_TENANT_ID, TRK_ARCHIVED)
VALUES ('purgeCartsId', 'PURGE_CARTS', 'CRON',
        'Purge Anonymous Carts', 'Y', 'N', '0 0 0 ? * * *', 'Y',
        '5DF1363059675161A85F576D', 'N');
INSERT INTO BLC_SCHEDULED_JOB_DETAIL (JOB_ID, NAME, VALUE, VALUE_SHA, DETAILS_ORDER)
VALUES ('purgeCartsId', 'purgeCartsAbandonedCartTimeout', '30d',
        'dccf34aa1f3e476c3d6ebdb7fa90c2850c88570f', 0),
       ('purgeCartsId', 'purgeCartsStatus', 'IN_PROCESS',
        '8bce62a26f6a264c91b76d61f0a61eaca2e95209', 1);