Menú

Detailed Overview of Cronjob Tasks in the Abandoned Cart Reminder Module

Cronjobs play a vital role in automating the workflow of the Abandoned Cart Reminder module. Thanks to these scheduled tasks, the module can continuously monitor customer activity, manage reminders, and send emails without requiring manual action. This article will walk you through all the tasks handled by cronjobs in the module, so you can better understand how everything works behind the scenes and how it contributes to recovering abandoned carts.

What does cronjob do?

1. Removing invalid data from the system

One of the first tasks cronjobs perform is cleaning up invalid or outdated records in the module. Over time, various data entries—such as broken carts, deleted reminders, or entries with missing information—can accumulate and affect the performance of the system.

This cleanup process targets entries in the module’s internal database tables, including carts that no longer exist in your PrestaShop store or reminders that have already been removed. By regularly removing these records, the module ensures that your reminder logic only works with up-to-date and valid data, reducing the chance of errors.

2. Cleaning up carts with invalid IDs or deleted references

Cronjob scans the Indexed Cart list (visible under Abandoned Cart Reminder > Mail Configuration > Indexed Cart in your back office). If it finds any cart that:

  • Has an invalid or missing cart ID
  • Has been deleted from the PrestaShop system
  • Has a corresponding reminder configuration that no longer exists

the system will automatically remove that entry from the indexed list.

3. Removing emails marked as unsubscribed

Cronjob will check each entry in the Indexed Cart list. If a customer's email is found in the Unsubscribe List (found under Mail Configuration > Unsubscribed List), the cronjob will automatically delete all their associated carts from the Indexed Cart. This ensures the module does not send any further reminders to users who have opted out.

4. Checking If Abandoned Carts Are Ready to Be Reminded

Cronjobs automatically scan all indexed carts to determine which ones have met the conditions to trigger a reminder email. These conditions include whether the cart has remained inactive for a specific amount of time, and whether the customer has already received a reminder.

This process is based on the reminder rules you’ve configured under Reminder Campaigns. Each campaign has a delay setting (e.g., 30 minutes, 1 hour, 24 hours), and the cronjob compares this delay against the time the cart was last updated or when the last reminder was sent. If the time threshold is reached, the cart is flagged as ready for the next reminder step.

You can review and fine-tune these conditions when editing a campaign in the backend.

5. Calculating Elapsed Time Since Cart Creation or Last Reminder

To determine whether a cart qualifies for a new reminder, the cronjob calculates how much time has passed since two possible points: when the cart was created, or when the last reminder was sent to the customer.

Once a cart has reached the time threshold defined in your campaign settings, the cronjob marks it as ready to move to the next stage in the reminder sequence. This includes both first-time reminders and follow-up messages, depending on your multi-step campaign design.

This timing logic is essential for sending emails at the right moment without spamming the customer. The calculation depends on each campaign’s configuration in Abandoned Cart Reminder > Campaigns, where you define the time delays between reminder stages.

This ensures a consistent and respectful email cadence that matches your marketing strategy.

6. Creating Reminder Emails Automatically (Email Queue)

For every cart that qualifies for a reminder, the cronjob generates the corresponding email and places it into the Email Queue. This queue acts as a waiting line where messages are prepared for sending in the next cronjob cycle.

The email content is generated based on your templates and campaign settings in Reminder Campaigns, including the subject line, body content, and any discount details. By handling this automatically, the cronjob ensures that you don’t need to manually prepare emails for each customer.

You can view the list of pending emails in Abandoned Cart Reminder > Email Queue.

7. Including Promotions and Discounts in Email Content

If your campaign is configured to offer a discount, the cronjob also generates a discount code and embeds it into the reminder email. This makes the offer more appealing and encourages the customer to return and complete their purchase.

The settings for automatic discount generation are found in the Discount Settings in each specific campaign. You can choose the type of discount, its value, expiration, and usage limits.

The generated code is saved in the system and attached to the email in the Email Queue, visible in the module backend under Campaign Tracking > Discounts.

8. Handling Customers Without Carts Who Are Eligible to Receive Emails

Cronjobs also support campaigns that are not based on abandoned carts. For example, some campaigns are triggered by other customer behaviors like account registration, newsletter signup, or completing a purchase. These are known as behavior-based campaigns and can run even when a customer doesn't have an abandoned cart.

During each run, the cronjob checks for customers whose actions match the trigger conditions of these behavior-based campaigns. If a match is found, the cronjob will create a personalized reminder email, generate a coupon code if the campaign includes one, and place the email into the Email Queue, just as it would with abandoned-cart-based campaigns.

You can create and manage these campaigns by going to Reminder Campaigns > Custom Emails and Newsletter, and creating a trigger type like Account creation, Newsletter subscription, or Order confirmation when creating or editing a campaign.

9. Handling Unsubscribed Users: Removing Emails, Logs, and Discount Codes

To respect customer privacy and comply with email marketing best practices, the module ensures that no communication is sent to users who have unsubscribed.

Each time the cronjob runs, it scans the Email Queue for entries linked to unsubscribed email addresses. If a match is found, the cronjob will immediately remove all scheduled emails for that customer from the queue. But it doesn't stop there—any associated tracking logs in the Tracking Log List and any discount codes previously generated for those emails are also deleted. This prevents accidental reuse or misuse of promotional content tied to unsubscribed users.

You can manage and view unsubscribed emails via Abandoned Cart Reminder module > Mail Configuration > Unsubscribed List, and you can monitor queued emails via Mail Configuration > Email Queue.

10. Sending Emails from the Queue

A core responsibility of the cronjob is to process and send emails that have been prepared and placed in the queue. During each execution, the cronjob checks the Email Queue and attempts to send out emails that are marked as pending. To ensure server stability and avoid triggering spam filters, the module respects the limits configured in Abandoned Cart Reminder > Mail Configuration, such as the maximum number of emails sent per run and the maximum retry attempts for failed emails.

For each email:

  • If the email is sent successfully, it is marked as "sent," and the action is logged in the Tracking Log List.
  • If the email fails to send, it will remain in the queue and the cronjob will retry sending it during the next execution.

You can monitor the status of queued emails and their sending results in Mail Configuration > Email Queue, and review delivery history in Mail Configuration > Mail Logs.

11. Removing Emails That Have Repeatedly Failed to Send

To keep the email queue clean and efficient, the cronjob also takes care of removing emails that have failed to send after multiple attempts. Each time a send attempt fails, the module records it and increases the retry count for that email. If the number of failed attempts exceeds the threshold configured in Automation > Configuration, the cronjob will automatically remove that email from the queue.

This helps prevent the system from wasting resources on emails that are unlikely to be delivered and ensures the queue remains focused on valid and deliverable messages.

You can track retry attempts and monitor email delivery statuses by visiting Mail Configuration > Email Queue.

12. Logging the Number of Sent Emails and Deleted Discount Codes

Every time the cronjob runs, it records detailed statistics to help store owners monitor the module’s performance. One of its tasks is to log how many emails were successfully sent during each run, along with how many discount codes were deleted—typically when they’re no longer needed or when associated emails are removed due to unsubscribing or repeated failures.

These logs are useful for understanding the effectiveness of your abandoned cart campaigns and tracking system activity over time.

You can view these logs directly in the module’s backend under Automation > Cronjob Logs.

If you’ve enabled the “Save cronjob log” option in the module's settings, the cronjob will automatically write log details during each run. It includes information such as the time cronjob run, the number of emails sent, and the number of discount codes deleted.

To enable or check this setting, go to Automation > Cronjob Logs and look for the “Save cronjob logs” option.

How to Configure Cronjob for the Abandoned Cart Reminder Module

To ensure that your reminder campaigns run smoothly, you need to set up a cronjob on your server.

  1. How to Set Up Cronjob in the Module:
  • Navigate to the module configuration page.
  • Click on "Automation" in the module's main menu.
  • Select the "Configuration" tab and follow the setup instructions.
  • Input the necessary parameters:
    • Maximum number of emails sent per cronjob run.
    • Mail queue retry attempts.
    • Cronjob secure token.

Set Up Cronjob on Your Server:

If you haven’t set up a cronjob on your server yet, follow our detailed blog post guide for step-by-step instructions.

  1. Important Note: Recommended Cronjob Frequency

After understanding the module workflow, you'll recognize the importance of setting up the cronjob correctly. We recommend setting the cronjob to run once per minute. This frequency ensures that indexed carts are continuously and promptly checked against your reminder conditions. Here’s why it’s important:

When a cronjob runs, it evaluates whether any carts in the indexed cart meet the criteria for a reminder. If a cart qualifies, the cronjob moves it to the mail queue for sending the reminder email. Running the cronjob more frequently means this process happens faster, reducing the delay between when a cart becomes eligible and when the reminder is sent.

For example, if your cronjob runs every minute, the system will check every 60 seconds whether there are any carts that match the reminder conditions, ensuring that reminder emails are sent as close to the scheduled time as possible. This accuracy is crucial for time-sensitive campaigns where timely follow-ups—such as offering a discount after 1 or 3 days—are key to increasing conversions. The faster the cronjob checks, the more precise your reminder schedule will be.

By running the cronjob once per minute, you ensure that reminders are sent at the right time, improving the effectiveness of your recovery campaigns. However, running the cronjob once per minute is not mandatory. Some servers are configured to send an email notification to the admin each time a cronjob runs. In such cases, running it every minute could lead to an overwhelming number of emails. If that's your case, you can choose to schedule the cronjob at a longer interval—such as every 30 minutes or even once per hour.

That said, the longer the interval, the more delay there will be in sending reminders. If you’re okay with this trade-off, it’s perfectly acceptable to adjust the schedule to suit your server setup.

Conclusion

Cronjobs are the backbone of automation in the Abandoned Cart Reminder module. From cleaning up outdated data and identifying abandoned carts to generating reminder emails and handling unsubscribed users, every task is executed seamlessly thanks to these scheduled processes.

Understanding how each cronjob task works not only helps you fine-tune your campaigns but also ensures better system performance and reliability. Make sure your cronjob is properly configured and running at the recommended frequency (once per minute) to take full advantage of the module’s automation power and maximize your cart recovery results.

Recuento de vistas: 38 vistas