1. Home
  2. Abandoned Cart Pro for WooCommerce – NEW
  3. Templates
  4. WP_Alternate_Cron to send reminder emails automatically

WP_Alternate_Cron to send reminder emails automatically

A key feature of Abandoned Cart Pro for Woo is sending automated emails that remind customers to complete their purchases. This is invaluable for recovering lost revenue from abandoned carts.

But you may find these reminder emails don’t get sent consistently. This is where an added functionality called WP-Cron job comes in.

WP-Cron is a behind-the-scenes WordPress feature that ensures scheduled tasks, like sending emails, run automatically at the right times.

By properly configuring WP-Cron, you can guarantee your abandoned cart reminder emails are sent reliably. This ensures customers get reminded and you recapture more lost sales.

In this guide, we’ll explain:

  • What WP-Cron is and how does it work
  • Steps to check if WP-Cron is enabled or disabled for the site
  • How does constant “define(‘ALTERNATE_WP_CRON’, true)” works

What is ‘WP-Cron’ and how does it work?

CRON is the name of a command that is used to schedule a future event to happen at a specific time and WP-Cron is how WordPress runs scheduled tasks automatically.

It’s like having a virtual assistant that handles regular jobs for you behind the scenes.

Some examples of tasks WP-Cron can schedule:

  • Sending emails
  • Publishing posts
  • Updating plugins

WordPress uses the file wp-cron.php to manage these scheduled events.

By default, WP-Cron checks if any tasks are ready to run every time someone visits your site.

For our plugin, the main task is sending the abandoned cart reminder emails.

WP-Cron makes sure these emails get sent out automatically based on the schedule you set.

So in simple terms, WP-Cron allows WordPress to handle regular tasks for you automatically in the background. This is very handy for things like email notifications that need to happen regularly and on time.

Steps to check if WP-Cron is enabled or disabled for the site

Follow these steps:

  1. Go to your WordPress site’s root folder on your server. This is where your WP-Config.php file is located.
  2. Open the WP-Config.php file in a text editor.
  3. Check if this code is present: define( ‘DISABLE_WP_CRON’, true );
  4. If it is set to true, your abandoned cart emails will NOT send automatically.
  5. Change true to false so the line looks like this: define ( ‘DISABLE_WP_CRON’, false );
  6. Save changes and your emails should now send automatically.

Alternate Method: If emails still don’t send automatically,

  1. Add this code to WP-Config.php: define(‘ALTERNATE_WP_CRON’, true); 
  2. Save changes.

Note: At times, there can be instances where for any reason the abandoned cart reminder emails do not get sent automatically to the customers. This is because of some settings in the server that restrict sending automatic reminder emails.

This alternate method can fix issues caused by server restrictions.

So in summary, you can set DISABLE_WP_CRON to false or add the ALTERNATE_WP_CRON code to enable automated emails.

How does constant “define(‘ALTERNATE_WP_CRON’, true)” works?

The ALTERNATE_WP_CRON constant uses a redirection method to run cron tasks.

Here’s how it works:

When WP-Cron needs to run scheduled tasks like sending emails, it will redirect users’ browsers temporarily.

This allows WP-Cron to keep running the tasks in the background.

At the same time, customers can immediately return to browsing your site.

So there is no interruption to users.

This alternate cron method can fix issues caused by web hosts blocking standard WP-Cron.

In summary:

  • ALTERNATE_WP_CRON uses redirections to keep WP-Cron running in the background.
  • Customers won’t notice anything different on your site.
  • It solves problems where web hosts block normal WP-Cron tasks.

This makes Abandoned Cart Pro for WooCommerce very reliable for sending automated emails. Even with restrictive web hosts, the alternate cron approach ensures your emails keep going out.

Was this article helpful to you? Yes No

How can we help?