The Ultimate Guide to WooCommerce Shortcodes (With Examples & Use Cases)

Shortcodes are the hidden power tools of WooCommerce. They let you instantly embed powerful eCommerce features—like carts, checkout forms, or product grids—anywhere on your WordPress site, without touching a single line of PHP or HTML.

Whether you’re a store owner, developer, or freelancer, mastering WooCommerce shortcodes gives you full control over how your products and store pages look and behave.

In this guide, you’ll learn everything about WooCommerce shortcodes—their syntax, use cases, examples, advanced layouts, and troubleshooting tips—plus how to simplify everything visually with ShopLentor, the ultimate WooCommerce page builder.

What Are WooCommerce Shortcodes and How Do They Work?

In WordPress, a shortcode is a small snippet of text enclosed in square brackets—for example, [example].

When WordPress encounters a shortcode, it runs a specific PHP function behind the scenes and dynamically inserts content like a gallery, form, or shopping cart.

WooCommerce extends this feature with its own set of shortcodes that handle core eCommerce functions—such as displaying products, checkout pages, or order tracking forms.

Why Shortcodes Are So Powerful

  • Flexibility: Place eCommerce content anywhere—pages, posts, widgets, or custom templates.
  • Simplicity: Replace hundreds of lines of code with a single shortcode.
  • Customization: Add parameters (attributes) to control layout, product count, or sorting.
  • Portability: Works with any WordPress theme or builder.
FeatureShortcode MethodVisual Builder
Learning CurveLow – simple syntaxModerate – interface navigation
SpeedInstant to addSlightly longer (drag-and-drop)
PortabilityWorks everywhereDepends on builder plugin
ControlAttribute-based precisionVisual design freedom

List of All Default WooCommerce Shortcodes (With Examples)

WooCommerce registers several core shortcodes to display essential pages of your store. These are the building blocks of your site’s eCommerce functionality.

ShortcodePurposeExample Usage
[woocommerce_cart]Displays the user’s shopping cart.[woocommerce_cart]
[woocommerce_checkout]Displays the checkout form.[woocommerce_checkout]
[woocommerce_my_account]Shows the My Account dashboard (login, orders, etc.).[woocommerce_my_account]
[woocommerce_order_tracking]Adds a form to track order status.[woocommerce_order_tracking]

Example:

WooCommerce Cart Shortcode
WooCommerce Cart Shortcode
<h2>Review Your Order</h2>
<p>Double-check your items before checkout:</p>
[woocommerce_cart]
WooCommerce Cart Page
WooCommerce Cart Page

Category & Product Display Shortcodes You Should Know

The [products] and [product_category] Shortcodes are the most versatile and frequently used ones. They let you showcase any product combination—on landing pages, blog posts, or even custom widgets.

1. The [products] Shortcode

The most flexible way to list products.

WooCommerce Product Display Shortcodes
WooCommerce Product Display Shortcodes
[products limit="8" columns="4" orderby="popularity" visibility="featured"]
WooCommerce Product Display
WooCommerce Product Display

Common Attributes:

  • limit – number of products to show
  • columns – number of columns per row
  • orderby – sort order (date, title, price, popularity)
  • category – show products from selected categories
  • on_sale="true" – display sale items only
  • ids="12,15,18" – show specific products by ID

2. Category Shortcodes

Show product categories or products from specific categories.

ShortcodePurposeExample
[product_categories]Lists all product categories.[product_categories number="6" parent="0"]
[product_category]Displays products from one category.[product_category category="accessories" columns="4" limit="8"]

Example:

WooCommerce Product Category Shortcode
WooCommerce Product Category Shortcode
<h2>See Our Category</h2>
[product_categories ids="12,45" columns="2"]
WooCommerce Product Category
WooCommerce Product Category

Customizing WooCommerce Pages Using Shortcodes

You don’t have to stick to the default WooCommerce layout. Shortcodes let you rebuild your shop, cart, or checkout pages to match your brand style.

1. Custom Shop or Category Page

<h2>Accessories</h2>
[product_category category="accessories" limit="8" columns="4"]
Custom Shop Page Shortcode
Custom Shop Page Shortcode
<h2>All Products</h2>
[products limit="-1" columns="4" paginate="true"]
Custom Shop Page
Custom Shop Page

2. Embedding in Page Builders

  • Elementor: Use the “Shortcode” widget
  • Gutenberg: Add a “Shortcode” block
  • ShopLentor: Drag and drop the “Woo Shortcode” widget and visually preview your layout

💡 Tip: Combine WooCommerce shortcodes with visual elements from ShopLentor to create high-converting landing pages.

Advanced Tips: Combining WooCommerce Shortcodes for Dynamic Layouts

Once you’re comfortable, you can combine shortcodes to create advanced layouts.

Example 1 – Featured + Sale Products:

<h2>Top Picks</h2>
[featured_products limit="4"]
<h2>On Sale Now</h2>
[sale_products limit="4"]

Example 2 – Cart Reminder with Deals:

<h2>Don’t Miss These Deals!</h2>
[products limit="2" on_sale="true" columns="2"]
<hr><h3>Your Shopping Cart</h3>
[woocommerce_cart]

Example 3 – Targeted Marketing Page:

<h2>Exclusive Offer</h2>
[products ids="12,14,25" columns="3"]

<a href=”/checkout” class=”button”>Buy Now</a>

You can also wrap them in <div> containers and add CSS for custom designs.

Common Errors & Troubleshooting

IssueCauseSolution
Shortcode appears as textMissing brackets or placed inside non-HTML blockUse the “Shortcode” block or widget
Nothing displaysMissing or wrong attributesAlways define limit, ids, or category
Styling issuesTheme or CSS conflictSwitch to default theme or adjust CSS
Not working in widgetText widget doesn’t parse shortcodesAdd add_filter('widget_text','do_shortcode'); to your theme

People Also Ask:

How Do I Create a Custom WooCommerce Shortcode?

Want something unique? You can create your own shortcode easily.
function wpb_custom_greeting_shortcode() {
if ( ! class_exists( ‘WooCommerce’ ) ) {
return ‘WooCommerce is not active.’;
}
return ‘👋 Welcome to our custom store! Enjoy 10% off today.’;
}
add_shortcode(‘store_greeting’, ‘wpb_custom_greeting_shortcode’);

Now you can use [store_greeting] it anywhere in your store.

Why Use ShopLentor Instead of Managing Shortcodes Manually?

While shortcodes are powerful, managing many at once can get messy.
ShopLentor simplifies everything — combining shortcode power with drag-and-drop design freedom.
With ShopLentor, You Can:
Build all WooCommerce pages visually
✅ Customize product grids, cart, checkout, and account pages
✅ Use ready-made templates or save your own
✅ See live previews — no shortcode syntax required
ShopLentor transforms shortcode complexity into intuitive, visual workflows.

ShopLentor- WooCommerce Builder for Elementor & Gutenberg

A versatile page builder to build modern and excellent online stores with more than 100k+ Active Installations.

Conclusion

WooCommerce shortcodes are the secret to unlocking limitless store customization.

They give you full control—whether you’re creating dynamic product displays, designing category pages, or adding quick-checkout options.

But if you’d rather skip the shortcode syntax and build visually, ShopLentor is your shortcut to the same flexibility—without the technical learning curve.

Asif Reza
Asif Reza

Asif Reza, a digital marketer and content writer at HasTech IT LTD, has three years of experience in eCommerce and WordPress. With expertise in SEO, research, and content editing, he delivers data-driven content that boosts online presence and business growth.

Articles: 285