How to Fix WooCommerce Scheduled Sales That Aren’t Updating

Last Updated September 23rd, 2020

It’s time for yet another fix to a frustrating WooCommerce problem. This time I’m going to walk you through the process of making WooCommerce scheduled sales work correctly.

A client wanted to setup some one day sales for products in their WooCommerce store. So they went into each product and set a scheduled sale. Here’s an example:

Woocommerce Scheduled Sale Example

They saved their changed products and waited patiently for midnight to strike on the start date of their sale for the new pricing to become available to their customers.

Midnight came. Nothing happened.

They waited until the morning just in case it was some weird time zone issue. Still nothing happened. The products were all listed at their regular prices.

Frustrated, they logged back in to delete their sale and try again just as they had done the day before. Then they saved the products a second time. Magically, their sale prices were now running and everything was working as they wanted.

Of course, what was the point of scheduling the sale if you ultimately had to manual update each product on the sale’s day to get results? To make matters worse, some days the sale prices weren’t being removed from the front end of the site even after the scheduled stop date had come and gone.

The Solution for Fixing Broken WooCommerce Scheduled Sales

I went down a handful of rabbit holes thanks to some bad advice on WooCommerce forums and ticket systems. A lot of people blamed other plugins or caching as the culprit for broken scheduled sales. Unfortunately, that ended up being a dead-end for me.

It eventually became clear this was a problem with WP Cron and WooCommerce’s scheduled tasks. In particular, I had to make some adjustments to the recurrence rate of the woocommerce_scheduled_sales cron event. This event is what triggers the actual pricing changes to the products with scheduled sales.

The best way to examine your sites WP Cron events is by using the excellently named WP Crontrol plugin. This beautiful piece of software lets you see exactly what scheduled events your WordPress install are set to run as well as what time and how often they execute.

Imagine my surprise when I learned the settings for woocommerce_scheduled_sales were telling it to run only once per day at exactly 11 PM.

woocommerce_scheduled_sales Cron Settings

The flaw here is pretty obvious. If the scheduled sale dates are set to go off at midnight they are never going to execute properly if the event that triggers them is executing itself an hour too early each day.

I changed the event’s recurrence to “Once Hourly” and made sure the next run was set an hour from my edit.

After forcing WP Crontrol to execute the task manually the sale prices on all products immediately began showing correctly.

Why does this happen?

There have been several issues with this client’s WooCommerce install ever since a version rollback from the initial 3.0 release. I’m not sure if that’s the culprit though. Many people have experienced the same issue and have reported it on various tech support boards and forums around the web (and few seem to have found the solution).

WP Cron is generally derided as a poor attempt at running scheduled tasks so maybe the base issue lies there. It depends on visitors to your site to actually initiate the execution of the events. A traditional cron job runs on the server and fires off when you tell it. This means you aren’t waiting for an unrelated website visitor to initiate the call.

In the end, the actual fix is very simple even if the cause isn’t so apparent. Hopefully, this post will help you get your troubles sorted out.

Looking for more help with WooCommerce?

Link Software LLC provides a host of WordPress plugin development services. Contact us to learn more about what we can offer.

We also have a brand new plugin that can help you with your online store: Remove WooCommerce Features.

With this plugin, you can remove and disable dozens of unwanted features that WooCommerce, and your theme, have enabled by default. Turn off specific checkout fields, remove related product listings, hide quantity buttons, and much more.