Theme sale countdowns
Many WooCommerce themes, Woodmart among them, show a countdown timer on a product whose sale has an end date. A discount rule can give its products that end date, so the theme’s timer counts down to the end of the rule’s sale.
Available since 0.4.0.
Switching it on
- Open the rule on the Discounts tab.
- Set a To date and time. The countdown needs one.
- Tick Show the theme’s sale countdown (needs a To date).
- Click Save Settings.
While the rule discounts a product, the rule’s To time is that product’s sale end date, and the theme shows its timer wherever it normally would.
The box is off by default.
How it works
The theme reads a product’s sale end date from WooCommerce, as it does for a sale you schedule on the product’s own screen.
- A rule that changes each product’s sale price writes the rule’s To time into each product’s sale end date along with the sale price, in place of any sale dates of the product’s own. When the sale ends, those dates are put back if the rule’s When the sale ends setting puts back the previous sale price.
- A display-only rule answers WooCommerce with the rule’s To time when the theme asks for the end date, and writes nothing.
With a display-only rule, a product that has its own sale end date keeps it, and the theme counts down to the product’s own date.
WooCommerce’s own scheduled sales also watch that end date, and can end the product’s sale at that moment. That is expected, and the product still gets back what the rule’s When the sale ends setting says.
Your theme shows no timer
- Check the theme’s own countdown option is switched on, in the theme’s settings.
- Check the rule has a To date in the future and is In force.
- Purge the page cache, or let page cache purging do it, so cached pages pick up the end date.
- A theme that draws its countdown only from its own product field, rather than WooCommerce’s sale end date, does not see a rule’s end date.
Further reading
Written for Super Speedy Ajax – Price Discounts 0.4.3.
Comments