Mastering the WooCommerce Products Shortcode (a Complete Guide)

Contents
Mastering the WooCommerce products shortcode | woocommerce shortcodes for products | WooPlugins
Contents

WooCommerce shortcodes are powerful tools that simplify how products are displayed on your store. They let you showcase products in various ways without complex coding. One shortcode stands out for its versatility: the [pro​ducts] shortcode.

The WooCommerce products shortcode ([produ​c​ts]) has become a all-in-one shortcode for WooCommerce users. Unlike older shortcodes such as WooCommerce featured products shortcode or sale products, this single shortcode can handle them all.

Want to display a specific product category? Highlight sale items? Or showcase your top-rated products? This shortcode makes it easy. It’s like an all-in-one solution for tailoring your product displays.

What makes this shortcode even more useful is its flexibility. With a wide range of attributes, such as category, tag, limit, and more, you can completely customize how products appear. Whether you want to create a grid of sale items or show all products in a WooCommerce category, you have complete control.

This shortcode isn’t just for simple displays, it replaces multiple shortcodes and offers advanced filtering and sorting.

For example, instead of relying on separate shortcodes for woocommerce sale products shortcode or woocommerce related products shortcode, the [prod​uc​ts] shortcode can do it all, saving time and simplifying your workflow. It’s your go-to shortcode for products in WooCommerce.

What is the WooCommerce Products Shortcode?

The WooCommerce products shortcode ([pro​ducts]) is one of the most versatile tools available in WooCommerce. It allows you to display your products in a highly customizable way, whether you’re highlighting categories, tags, or even specific sale items.

As part of WooCommerce’s built-in functionality, this shortcode simplifies how you organize and present products, offering unmatched flexibility.

With the [pro​ducts] shortcode, you can replace older WooCommerce shortcodes for products like those for featured products, top-rated products, or sale products. For example, instead of using separate shortcodes for each, you can now use this single shortcode to handle all scenarios.

It’s compatible with WooCommerce 3.2 and later, ensuring seamless integration with modern versions of the platform.

This shortcode shines because of its flexibility. You can use it to show specific categories of products—perfect for those who want to emphasize certain product lines.

For instance, if you’re running a seasonal campaign, you can use the shortcode to show products tagged with a specific tag, such as “Summer Sale.” It’s also ideal for creating grids of sale items, highlighting popular products, or simply listing all your products.

Key use cases include:

  • Displaying WooCommerce shortcodes products by categories, tags, or attributes.
  • Showcasing related products or sale products with a single command.
  • Using pagination and filters to refine how products appear to your audience.

For example, to display all products in your store, you can use:

PHP
[products]

Or to show a specific product category:

PHP
[products category="electronics"]

Whether you’re creating a basic display or advanced product grids, the woocommerce products shortcode adapts to your needs. It’s an essential shortcode for managing and presenting products in WooCommerce.

Attributes of the WooCommerce Products Shortcode

The WooCommerce products shortcode ([prod​​ucts]) is highly customizable. These attributes allow you to tailor how products appear on your WooCommerce store, from organizing by categories to controlling pagination.

Below is a table summarizing all the available attributes:

AttributeDescription
limitSets the maximum number of products to display.
columnsDetermines the number of columns in the product grid.
rowsDefines the number of rows to display.
orderbySorts products by specific parameters like date, price, popularity, etc.
orderSpecifies the sorting order: ascending (ASC) or descending (DESC).
idsDisplays specific products by their IDs.
skusDisplays specific products by their SKUs.
categoryFilters products by categories.
cat_operatorControls how categories are filtered (IN, NOT IN, AND).
attributeFilters products by a custom attribute.
termsFilters products by specific attribute terms.
terms_operatorSpecifies how terms are filtered (IN, NOT IN, AND).
tagFilters products by tags.
tag_operatorDefines how tags are filtered (IN, NOT IN, AND).
visibilityFilters by product visibility (e.g., catalog, search, hidden).
classAdds a custom CSS class for styling the product grid.
pageSpecifies the page number for pagination.
paginateEnables or disables pagination (true or false).
cacheEnables or disables caching for the shortcode (true or false).
Source:
WooCommerce Docs

Limit

The limit attribute controls how many products are displayed. By default, WooCommerce shows a specific number of products based on your store’s settings. With this attribute, you can override that limit.

Example: To display only 4 products:

PHP
[products limit="4"]

This is especially useful for creating curated product sections, like highlighting a few sale items on your homepage.

Columns

The columns attribute determines how many products appear in a single row. It’s perfect for adjusting layouts on different parts of your store.

Example: To display products in a three-column grid:

PHP
[products columns="3"]

Combining limit and columns can help you create grids tailored to your design preferences.

Rows

The rows attribute specifies the number of rows displayed. While this isn’t as commonly used, it can be helpful when combined with pagination.

Example: To display two rows of products:

PHP
[products rows="2"]

This works well for featured sections where you want to avoid showing too many products at once.

Orderby and Order

The orderby attribute lets you sort products by different parameters, like price, title, or popularity. The order attribute works alongside it to define whether the sorting is ascending (ASC) or descending (DESC).

Example: To show the most expensive products first:

PHP
[products orderby="price" order="DESC"]

This is great for creating premium product displays or showcasing discounted items.

IDs and SKUs

If you want to display specific products, the ids and skus attributes are your go-to options. Use ids for product IDs and skus for stock-keeping units.

Example: To display products with IDs 10, 20, and 30:

PHP
[products ids="10,20,30"]

Example: To display products with specific SKUs:

PHP
[products skus="SKU001,SKU002"]

These attributes are ideal for creating highly targeted product displays.

Category and Cat Operator

The category attribute filters products by specific categories. The cat_operator attribute lets you control how multiple categories are handled (IN, NOT IN, AND).

Example: To display products from the “electronics” category:

PHP
[products category="electronics"]

Example: To display products in both “clothing” and “accessories” categories:

PHP
[products category="clothing,accessories" cat_operator="AND"]

This is perfect for creating category-specific landing pages.

Attributes, Terms, and Operators

For filtering by custom attributes, use attribute and terms. The terms_operator defines how terms are handled (IN, NOT IN, AND).

Example: To display products in specific colors (e.g., “red” and “blue”):

PHP
[products attribute="color" terms="red,blue" terms_operator="IN"]

This is especially useful for stores with extensive attribute-based filtering.

Tags and Tag Operator

The tag attribute filters products by tags, and tag_operator controls how those tags are applied.

Example: To display products tagged with “summer-sale”:

PHP
[products tag="summer-sale"]

Example: To exclude products with a specific tag:

PHP
[products tag="clearance" tag_operator="NOT IN"]

These attributes help you manage seasonal campaigns and promotions.

Visibility

The visibility attribute filters products by their visibility status, such as catalog, search, or hidden.

Example: To show products visible only in the catalog:

PHP
[products visibility="catalog"]

This is a great way to manage hidden or restricted products.

Class

The class attribute allows you to add custom CSS classes to the product grid, making it easier to style with your theme.

Example:

PHP
[products class="custom-grid"]

Pagination and Cache

The paginate attribute enables pagination for long product lists, while cache controls whether the shortcode output is cached.

Example: To enable pagination:

PHP
[products paginate="true" page="2"]

Example: To disable caching:

PHP
[products cache="false"]

Pagination ensures a smooth user experience, while cache control improves performance during updates.

These attributes make the [pro​ducts] shortcode one of the most powerful tools in WooCommerce. Use them creatively to craft unique product displays that engage your customers.

Practical Scenarios for Using the WooCommerce Products Shortcode

Here are 5 scenarios where you can effectively use the WooCommerce products shortcode ([prod​ucts]) to customize your WooCommerce store. Each scenario includes an explanation and example code to make it easy to implement.

Scenario 1: Display All Products in a Grid (WooCommerce All Products Shortcode)

If you want to showcase all your products in a grid layout, this is the simplest and most versatile option. By default, the [prod​ucts] shortcode displays all products in your store.

You can further customize the grid by specifying the number of columns.

Example:

PHP
[products limit="12" columns="4"]

This displays up to 12 products in a 4-column grid. It’s perfect for creating a general product catalog or a landing page for all products.

Example of scenario 1, showing 12 products in 4 columns with WooCommerce products shortcode
Example of scenario 1, showing 12 products in 4 columns with WooCommerce products shortcode.

Scenario 2: Showcase Products from a Specific Category (WooCommerce Shortcodes Products by Categories)

You might want to highlight products from a specific category, such as “Electronics” or “Clothing.” The category attribute lets you do this seamlessly.

Example:

PHP
[products category="electronics" limit="8" columns="4"]

This displays up to 8 products from the “Electronics” category in a 4-column grid. You can replace “electronics” with the slug of any category in your store. This is great for seasonal promotions or category-specific landing pages.

Scenario 3: Highlight Sale Products (WooCommerce Sale Products Shortcode)

If you’re running a sale, it’s a good idea to display all discounted products in one place. The [pro​ducts] shortcode makes this simple using the on_sale parameter.

Example:

PHP
[products on_sale="true" limit="6" columns="3"]

This displays 6 sale products in a 3-column grid. Use this on your homepage or a dedicated “Sale” page to grab attention.

Scenario 4: Display Specific Products by ID

If you want to highlight only a few specific products, you can use the ids attribute. This is helpful for promoting featured or best-selling items.

Example:

PHP
[products ids="15,23,42" columns="3"]

This displays the products with the IDs 15, 23, and 42 in a 3-column grid. It’s ideal for showcasing a curated selection of products.

Scenario 5: Filter Products by Tags and Attributes

You can filter products using tags or custom attributes to target specific customer preferences. For example, showing products with a specific tag like “Summer Sale” or filtering by an attribute like color.

Example 1: Filter by tag

PHP
[products tag="summer-sale" limit="9" columns="3"]

Example 2: Filter by attribute and terms

PHP
[products attribute="color" terms="red,blue" columns="4"]

These scenarios work well for campaigns or sections targeting particular customer needs, such as showcasing products of a specific style or seasonal promotion.

Scenario 6: Paginated Product Listing for Large Inventories

For stores with large inventories, enabling pagination ensures users can navigate through products without overwhelming them.

Example:

PHP
[products limit="12" columns="4" paginate="true"]

This displays 12 products per page in a 4-column grid and enables pagination to navigate to the next set of products.

Example of scenario 6, showing 12 products per page with pagination using WooCommerce products shortcode.
Example of scenario 6, showing 12 products per page with pagination using WooCommerce products shortcode.

These scenarios demonstrate how flexible the [prod​ucts] shortcode can be. Whether you’re targeting a specific audience or creating a broad product catalog, you can adapt these examples to meet your store’s needs.

Conclusion

The WooCommerce products shortcode is a powerful and flexible tool that transforms how you display products in WooCommerce.

With its wide range of attributes, it replaces older shortcodes like woocommerce related products shortcode or woocommerce sale products shortcode, giving you a single solution to manage all product displays. Whether you want to show products by categories, tags, or even specific IDs, this shortcode has you covered.

Using the woocommerce products shortcode, you can fully customize layouts, apply filters, and create dynamic displays that enhance your store’s functionality.

From setting the number of rows and columns to filtering by attributes, tags, or categories, the possibilities are nearly endless. This makes it an essential feature for any WooCommerce store.

Experimenting with attributes is the best way to unlock the shortcode’s full potential. Want to create a grid for a specific campaign? Use the woocommerce shortcodes products by categories attribute.

Need a list of all products? The show all products woocommerce shortcode is just one line of code. You can even refine layouts with custom CSS using the class attribute.

By replacing outdated shortcodes with this all-in-one option, you simplify your workflow while gaining more control over product displays.

The shortcode for products in WooCommerce is more than a convenience, it’s a key tool for creating a professional and user-friendly shopping experience. Take some time to explore its flexibility and see how it can help your store stand out.

WooCommerce Customization Setup & Configuration

Got Questions or Ideas? Let’s Chat in the Comments!

Leave a Reply

Your email address will not be published. Required fields are marked *

Boost Your Sales with {product_name} 🚀

Create stunning sales notifications on your site with ease. Try the Lite Version of Notifal today and start seeing results!

Install Notifal Now