
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?
- List of All Default WooCommerce Shortcodes (With Examples)
- Category & Product Display Shortcodes You Should Know
- Customizing WooCommerce Pages Using Shortcodes
- Advanced Tips: Combining WooCommerce Shortcodes for Dynamic Layouts
- Common Errors & Troubleshooting
- People Also Ask:
- Conclusion
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.
| Feature | Shortcode Method | Visual Builder |
|---|---|---|
| Learning Curve | Low – simple syntax | Moderate – interface navigation |
| Speed | Instant to add | Slightly longer (drag-and-drop) |
| Portability | Works everywhere | Depends on builder plugin |
| Control | Attribute-based precision | Visual 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.
Shortcode Purpose Example 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:

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

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.

[products limit="8" columns="4" orderby="popularity" visibility="featured"]

Common Attributes:
limit– number of products to showcolumns– number of columns per roworderby– sort order (date,title,price,popularity)category– show products from selected categorieson_sale="true"– display sale items onlyids="12,15,18"– show specific products by ID
2. Category Shortcodes
Show product categories or products from specific categories.
Shortcode Purpose Example [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:

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

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"]

<h2>All Products</h2>
[products limit="-1" columns="4" paginate="true"]

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
| Issue | Cause | Solution |
|---|---|---|
| Shortcode appears as text | Missing brackets or placed inside non-HTML block | Use the “Shortcode” block or widget |
| Nothing displays | Missing or wrong attributes | Always define limit, ids, or category |
| Styling issues | Theme or CSS conflict | Switch to default theme or adjust CSS |
| Not working in widget | Text widget doesn’t parse shortcodes | Add 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.







