WooCommerce includes a powerful, built-in [products] shortcode that allows you to display your donation projects (which are set up as WooCommerce products) anywhere on your site—whether it’s a blog post, a custom landing page, or your homepage.
By using specific attributes, you can filter, order, and showcase exactly the right fundraising campaigns to your donors.
1. Basic Usage
To display a simple grid of your most recent donation projects, simply paste the following shortcode onto any page or post:
[products]By default, this will display your newest projects in a 4-column grid.
2. Essential Attributes
You can customize the shortcode by adding attributes. Here are the most useful ones for a donation or fundraising platform:
Displaying Specific Donation Campaigns
If you want to feature specific projects, you can target them by their IDs or SKUs.
- By ID:
[products ids="123, 456, 789"](Great for a “Featured Campaigns” section) - By SKU:
[products category="disaster-relief"]
Showing Specific Donation Categories
If you organize your campaigns by causes (e.g., Environment, Education, Disaster Relief), you can display projects from just one category using the slug:
[products category="disaster-relief"]Controlling the Layout & Limit
You can limit how many campaigns are shown and how they are arranged to fit your theme’s design:
- limit: The total number of projects to display.
- columns: How many columns to split them into.
[products limit="3" columns="3"](Perfect for a clean, 3-campaign row)
Ordering Your Campaigns
You can change the order in which your donation projects appear based on popularity, date, or a random mix to give all campaigns equal visibility.
- Random order:
[products orderby="rand"] - Most popular/most donated to:
[products orderby="popularity"] - Newest campaigns first:
[products orderby="date" order="DESC"]
3. Practical Examples for Your Site
Here are a few copy-and-paste examples you can use right away:
Example A: Feature 3 Urgent Campaigns
Showcases three specific high-priority donation projects in a three-column layout.
[products ids="123, 456, 789" columns="3"]Example B: Show Latest 4 “Education” Projects
Automatically pulls the 4 newest campaigns from your “Education” cause category.
[products limit="4" columns="4" category="education" orderby="date" order="DESC"]Example C: “Discover Causes” (Randomized Grid)
Shows 6 random donation projects every time the page refreshes, ensuring all your campaigns get exposure.
[products limit="6" columns="3" orderby="rand"]Quick Reference Table
| Attribute | What it does | Example Value |
limit | Sets the maximum number of projects to show | limit="4" |
columns | Sets how many columns wide the grid will be | columns="2" |
category | Filters by the category slug of your cause | category="medical" |
ids | Displays specific projects using their unique IDs | ids="99, 105" |
orderby | Sorts projects (date, id, popularity, rand) | orderby="popularity" |
order | Determines ascending (ASC) or descending (DESC) | order="ASC" |
💡 Tip: To find a donation project’s ID, navigate to your WordPress dashboard, go to Products > All Products, and hover your mouse over the title of the project. The ID will appear in small text next to the “Edit” links.
