To show all discounted products on one page in WooCommerce, add the [alg_wc_gsd_products] shortcode from Sitewide Discount for WooCommerce to any page. It lists every product currently on sale, including products discounted by your groups at WPFactory > Global Shop Discount, in a standard WooCommerce product grid.
![a front-end "Sale" page built with the [alg_wc_gsd_products] shortcode](https://wpfactory.com/wp-content/uploads/sitewide-discount-sale-products-page-1.png)
Before you start #
- At least one discount group is set up and Global Shop Discount (Enable plugin) is ticked on the General section. The shortcode is only available while the plugin is enabled.
- The shortcode is included in both the free and Pro versions.
Steps #
- Go to Pages > Add New Page and give the page a title, such as “Sale”.
- Add a Shortcode block and enter:
[alg_wc_gsd_products use_transient="yes" columns="4" on_empty="No sale items right now."]
- Publish the page and view it.
Shortcode attributes #
| Attribute | What it does | Default |
|---|---|---|
use_transient |
Set to yes to store the list of on-sale product IDs for 24 hours instead of rebuilding it on every page view. |
Off |
on_empty |
Text or HTML shown when no products are on sale. | Empty (nothing shown) |
Any [products] attribute |
Every other attribute is passed to the WooCommerce [products] shortcode, for example columns, limit, orderby, order or paginate. |
WooCommerce defaults |
What counts as “on sale” #
The shortcode lists products that WooCommerce reports as on sale. That includes products discounted by Sitewide Discount and products with their own sale price set in the product editor. It checks the whole catalog, then passes the matching product IDs to the [products] shortcode.
Keeping the list fresh #
With use_transient="yes", the list is cached for a day. After you change your discount groups or start a new sale, clear it:
- Go to WPFactory > Global Shop Discount > Tools.
- Tick Delete transients and click Save changes. A message confirms how many transients were deleted.
Frequently asked questions #
Why should I use use_transient? #
Without it, the shortcode loads every product in your store on each page view to check which are on sale. On a large catalog that slows the page down. With use_transient="yes", the check runs once a day.
Can I show only products from one category? #
The shortcode passes attributes to [products], so you can add category="your-category-slug" to limit the grid, as with the standard WooCommerce shortcode.
The page shows “No sale items” but my discount is active. Why? #
If use_transient="yes" is set, the list may have been saved before the discount started. Run Delete transients in the Tools section and reload the page.
Does the grid show the discounted prices? #
Yes. Products in the grid show the same crossed-out regular price and discounted price as the rest of your shop.
Related guides #
Get Sitewide Discount #
The sale products shortcode is included in the free version of Sitewide Discount for WooCommerce. See the plugin page for plans and updates.
Need a hand? Our team answers every ticket on the Sitewide Discount support forum.