Schedule Sale Campaigns
A store-wide sale in WooCommerce means editing sale prices product by product, or a bulk edit you have to undo by hand when the sale ends. Forget one product and it stays cheap for weeks. A countdown that runs on the shopper’s device clock can say the sale ends in two hours when it ended yesterday.
Sale Campaigns schedules sales that start and end by themselves. Pick the dates, the discount and the products, and campaign prices apply from the first minute to the last. Product prices are never changed, so regular prices come back on time. Each campaign can replace the sale badge text, show an announcement bar, and power a countdown that runs to the real end.
Turn On Sale Campaigns
- Open Stackless → Dashboard and turn on Sale Campaigns in the Sales & invoices section.
- Open Stackless → Sale campaigns and click Add campaign.
- Fill in the campaign, click Preview affected products to check the prices, then click Save campaign.
The screen shows the site time and time zone at the top. Campaign times use that time zone.
Fill In a Campaign
- Name: up to 120 characters. Shoppers see it next to sale prices in the cart, so use something like Black Friday.
- Starts and Ends: a date and time in the site time zone. The sale price applies from the start minute, and regular prices from the end minute.
- Discount: Percentage off or Fixed amount off each item, in your store currency. A percentage goes up to 100 and takes decimals such as 12.5.
- Applies to: The whole store (default), Chosen categories or Chosen products. A category covers its subcategories. A chosen product covers all its variations, or pick single variations.
- Leave out categories and Leave out products: these stay at their regular price, whatever the campaign applies to.
- Subscriptions: Include subscription prices is off by default.
- Coupons: Coupons also work on sale items (default) or Coupons skip sale items.
- Badge: up to 30 characters, “Sale” by default. It replaces the text of WooCommerce’s sale badge on campaign items. Leave it empty to keep WooCommerce’s own label.
- Announcement bar: Show a bar with a countdown at the top of every page while the campaign runs, with a Message of up to 200 characters and an optional Link.
A store can hold up to 200 campaigns. Delete ended ones to make room.
Preview the Prices
Preview affected products lists up to 50 products and variations with their Regular price, Sale price and a Note. A scheduled campaign is shown as it would price things at its start. The note says when something else wins, such as a product’s own running sale or another campaign.
The preview reads the first 500 products and variations only. The campaign itself has no limit.
How the Sale Price Is Worked Out
- The discount comes off the regular price of each item.
- A percentage is rounded to your currency’s smallest unit.
- A fixed amount that’s as large as a product’s price or larger skips that product. It keeps its regular price, unless another campaign covers it. The preview shows it as “Not discounted” with a note that it was skipped.
- A percentage of 100 is taken as a giveaway: the products it covers are free while the campaign runs, and the preview notes “Free while the campaign runs.”
- Products whose buyer names the price with Pay What You Like are left out, so their own price and minimum stand.
- A product’s own WooCommerce sale price wins while it runs, even when the campaign would be deeper.
- A product with no regular price, a variable product’s parent and a grouped product aren’t priced themselves. Their variations and the products inside a grouped product are.
Campaigns never stack. When two running campaigns cover the same product, the more specific one wins: a chosen variation, then a chosen product, then a category, then the whole store. That holds even when the broader campaign is deeper. Between two equally specific campaigns, the lower price wins, and on a tie the older campaign.
With Multi-Currency on, a percentage comes off the price in the shopper’s currency. A fixed amount is converted from your store currency, and a product it would make free is skipped in that currency too. The product page and the cart show the same price.
What Shoppers See
- WooCommerce’s regular price struck through next to the campaign price, on the shop, the product page, the cart and checkout.
- Your badge text on WooCommerce’s sale badge, in classic templates and in the Product Sale Badge block.
- A “Sale price” line with the campaign name under each campaign item in the cart and checkout.
- The announcement bar at the top of every page except checkout, when the campaign has one. Only one bar shows at a time: the running campaign that ends first. Shoppers can dismiss it, and it stays dismissed for that campaign.
The order screen notes each campaign item with “Sale price from the campaign” and its name.
Carts are priced again on every page load and when the order is placed. A cart filled during a sale and paid after it ends is charged regular prices.
Add a Countdown
Add the Sale countdown block, or this shortcode, anywhere:
[stackless_sale_countdown campaign="12" label="Sale ends in" ended="This sale has ended."]
campaign: the campaign ID, shown in the shortcode on the campaign’s edit screen. Leave it out to follow the running campaign that ends first.label: the text before the time left. “Sale ends in” by default.ended: the text once time is up. Leave it out to remove the countdown.
The block has the same three settings: Campaign ID, Label and Text after the sale ends. The countdown shows days, hours, minutes and seconds, and an “Ends” line in the shopper’s local time. It reads the time from your server, so a wrong device clock or a cached page can’t make it lie. With no campaign running, the block and shortcode show nothing.
Start, End and Caches
Prices follow the clock on each request, so they never wait for a scheduled task. When a campaign starts or ends, Stackless clears WooCommerce’s product caches and the page cache of WP Rocket, WP Super Cache, W3 Total Cache, SiteGround, LiteSpeed, Breeze, Cache Enabler and Nginx Helper.
The list shows each campaign’s Campaign, Status (Scheduled, Active or Ended), Starts, Ends, Discount and Applies to. Row actions:
- Edit: change anything. Saving a running campaign applies the change at once.
- Duplicate: a copy with “(copy)” added to the name and the dates cleared, for next year’s sale.
- End now: on a running campaign. Regular prices apply at once.
- Delete: a running campaign ends at once.
Campaign Prices Across the Store
- Sorting and filters: sorting by price, the price filter, on-sale product lists such as
[sale_products], and the on-sale and price filters of the Store API that the blocks use follow running campaigns. They catch up in the background shortly after a campaign starts, ends or is edited, and go back to the products’ own prices when it ends. - Google Product Feed: the feed sends the campaign price as the sale price with the campaign’s start and end dates, for a running campaign and for the next scheduled one. Adding, editing, starting or ending a campaign rebuilds the feed.
- Product add-ons: paid add-ons are added on top of the campaign price.
- Wholesale Pricing: a wholesale price wins over a campaign for the customers it applies to.
- Coupons: a coupon is worked out on the sale price. With Coupons skip sale items, coupons still work on the rest of the cart. A coupon set to exclude sale items skips campaign items either way.
- Subscriptions: with Include subscription prices ticked, a subscription bought during the sale keeps renewing at the sale price, because renewals charge the price paid at signup. Signup fees are never discounted. For a discount on the first payment only, use a coupon.
- Offers with their own price: order bumps and post-purchase offers are charged at their own offer price, which a campaign doesn’t lower. The bump card shows the price that’s charged.
Limits
- No repeating campaigns. Duplicate last year’s campaign and set new dates.
- No targeting by tag, brand, role or customer.
- A product’s own WooCommerce sale price always beats a campaign.
- The announcement bar needs a theme that supports
wp_body_open. - Host and CDN caches outside the eight plugins above aren’t cleared. Hook them up with
stackless_sale_campaigns_purged. - The WooCommerce REST API and the product CSV export show stored prices, not campaign prices.
For Developers
Actions fire with the campaign array and a timestamp: stackless_sale_campaigns_started, stackless_sale_campaigns_ended (also when a running campaign is ended early or deleted) and stackless_sale_campaigns_updated (a running campaign was edited). stackless_sale_campaigns_purged runs after the cache clear, so you can clear a cache Stackless doesn’t know:
add_action('stackless_sale_campaigns_purged', function () {
if (function_exists('wpfc_clear_all_cache')) {
wpfc_clear_all_cache(true);
}
});
stackless_sale_campaigns_purge_page_cache:bool $purge, array $campaign. Return false to skip the page cache clear.stackless_sale_campaigns_applies:bool $applies, whether campaign prices apply to the current request. It’s false for the WooCommerce REST API and the product export.stackless_sale_campaigns_deal:null, WC_Product $product, int $now, the campaign that discounts a simple product or variation now, or else the next scheduled one, with its regular and sale price, start and end. The Google Product Feed reads it.stackless_sale_campaigns_changed: action after any campaign is added, edited or deleted, running or not.stackless_sale_campaigns_lookup_synced: action when sorting, the price filter and on-sale lists match the running campaigns again.