28 May 2025
32
17 min
0.00

WooCommerce Shortcodes: A Comprehensive Guide for Beginners
Running a WooCommerce store requires owners to wear many hats at once—marketing, operations, design, and even web development. But what if coding skills are not your strongest suit? That’s where WooCommerce shortcodes come into play. This feature allows store owners to customize nearly every aspect of the ecommerce store without needing to dive deep into complex code.
WooCommerce powers a significant portion of all online stores—figures often cite it being used by over 4.6 million of active websites worldwide. Given this widespread adoption, understanding shortcodes becomes important for users of the platform.
In this guide for ecommerce marketers, we’ll explain all you need to master WooCommerce shortcodes. We'll break down what they are, how they function, and explore a list of essential shortcodes for any WooCommerce store.
What Are WooCommerce Shortcodes?
WooCommerce shortcodes are a simple yet reliable solution for ecommerce store customization. In simple terms, they are small, reusable snippets of code that you wrap in square brackets—like [this_is_a_shortcode]. These commands tell WordPress to perform specific actions or display dynamic content right where you place them.
The concept of shortcodes isn't new. They’ve been a part of WordPress for a good while, allowing users to embed complex features. WooCommerce extends this functionality, adjusting it specifically for the needs of ecommerce stores. Here are some popular ways to use them:
- Showcasing products anywhere, not just on the default shop page with [products], [featured_products], or [sale_products].
- Access the full shopping cart contents and functionality using [woocommerce_cart].
- Place the entire checkout process on any page with [woocommerce_checkout].
- Allow users to view their orders and manage their details using [woocommerce_my_account].
- Display a single product's “add to cart' button” with [add_to_cart], and more.
There are multiple reasons why WooCommerce shortcodes are popular among store owners. Firstly, they’re incredibly easy to use—no deep coding knowledge required. Secondly, they offer flexibility, allowing to control what appears and how. And finally, they are a time-saver, streamlining the process of adding new elements to the site.
Shortcodes vs. blocks
Since the introduction of the Gutenberg editor, WooCommerce has shipped dozens of Blocks—visual, drag-and-drop equivalents of every major store component (Cart, Checkout, Product Grid, Filters, etc.). Blocks are now WooCommerce’s recommended way to add store functionality because they’re easier to customize and preview in real time. Shortcodes remain fully supported for backward compatibility (and for themes that still rely on them), so everything in this guide still works.
How Do WooCommerce Shortcodes Actually Work?
Now, let’s explore how WooCommerce shortcodes actually work. When you embed a shortcode into a page or post, WooCommerce doesn’t just see it as plain text. As the page loads, WooCommerce scans the content specifically looking for those telltale square brackets.
Once it identifies a shortcode, it launches a pre-written PHP function associated with that specific command. This function then does the heavy lifting—fetching product data, calculating cart totals, or laying out account information—and generates the HTML that appears on the front end of your store.
As you’ve seen, WooCommerce shortcodes can be customized using attributes or parameters. These are extra instructions within the shortcode brackets to modify its behavior. For example, with the products shortcode, you might use an attribute like limit="4" to show only four products, or columns="2" to arrange them in two columns.
WooCommerce itself offers a set of eleven core shortcodes, many of which come with multiple attributes, giving users control without needing additional plugins for basic content display. Some third-party plugins and themes provide access to more shortcodes beyond the core ones.
Essential WooCommerce Shortcodes for Better Management of Your Online Store
Since we already covered what WooCommerce shortcodes are and how they operate, we can proceed to the main part: the actual shortcodes. Using them, you can change the way you build and manage your online store.
When applied correctly, shortcodes can improve user experience, streamline navigation, and guide your customers smoothly towards making a purchase. We'll explore a variety of core WooCommerce shortcodes, breaking them down into how they handle core pages, display your products in enticing ways, and drive specific actions.
Page-Specific WooCommerce Shortcodes
Certain pages are fundamental to any online store, and WooCommerce provides dedicated shortcodes to ensure everything works correctly. These are often set up automatically when you first install WooCommerce, but knowing them allows you to rebuild pages or customize their placement if needed.
- Cart page: [woocommerce_cart]
The [woocommerce_cart] shortcode, often referred to as the woocommerce cart page shortcode or simply the woocommerce cart shortcode, displays the customer's shopping cart contents. This includes the items added, quantities, prices, and the all-important "Proceed to Checkout" button.
It’s a critical part of your ecommerce funnel, so make sure everything is working correctly.
How to use: Simply place [woocommerce_cart] on your designated cart page.
- Checkout page: [woocommerce_checkout]
Once customers are ready to buy, the woocommerce checkout shortcode, [woocommerce_checkout], takes over. It proceeds to create the entire checkout page, where customers input their billing and shipping details, choose shipping methods, and select their payment option. This is where the sale is finalized.
How to use: Add [woocommerce_checkout] on the page you’ve set as your checkout page.
I want to improve my WooCommerce marketing!
- My Account page: [woocommerce_my_account]
Use [woocommerce_my_account] to give your customers a dedicated space to manage their information. It displays the user account dashboard where they can view past orders, manage addresses, and update account details.
How to use: Add [woocommerce_my_account] you want to use for "My Account."
- Order tracking: [woocommerce_order_tracking]
The [woocommerce_order_tracking] shortcode allows customers to check the status of their orders by entering their order ID and email address, providing order tracking information without needing to log in.
How to use: Place [woocommerce_order_tracking] on a dedicated "Track Your Order" page. Alternatively, you can add this to the "My Account" page.
Product Display WooCommerce Shortcodes
Showcasing your products is where WooCommerce shortcodes truly shine, offering flexibility in how and where your items appear. A good product display can influence purchasing decisions and improve the overall design and feel of your site.
- General products display: [products]
The [products] shortcode is possibly the most used of the product-related WooCommerce shortcodes. It's your go-to WooCommerce products shortcode, allowing to display products in different ways using attributes. The woocommerce shortcodes list of attributes for this one is quite extensive, including:
- ids or skus: Display specific products.
- limit: The number of products to show (e.g., limit="6").
- columns: The number of columns in the grid (e.g., columns="3").
- orderby: How to sort products (e.g., date, title, popularity, rating, rand). Common values are orderby="date" or orderby="popularity".
- order: The sort order (ASC for ascending, DESC for descending).
- category: Display products from specific category slugs.
- tag: Display products with specific tags.
- on_sale="true": Show only products currently on sale.
- best_selling="true": Showcase your best sellers.
- top_rated="true": Highlight top-rated products.
- visibility: Control product visibility (e.g., visible, catalog, search, hidden).
Examples:
[products limit="4" columns="4" category="apparel" orderby="date" order="DESC"]– Shows the 4 newest products from the "apparel" category in 4 columns.
[products ids="25, 30, 42" columns="3" orderby="title"] – Displays three specific products, ordered by title.
- Specific product types:
While the main [products] shortcode can handle most scenarios with attributes, WooCommerce also offers some legacy or more direct WooCommerce shortcodes for common needs:
- [featured_products limit="3" columns="3"]: Quickly show your featured items.
- [sale_products per_page="6" columns="2"]: Display 6 products currently on sale in 2 columns.
- [best_selling_products limit="5" columns="5"]: Highlight your top 5 best-selling items.
- [top_rated_products per_page="4" columns="4"]: Show off your 4 highest-rated products.
- [recent_products limit="8" columns="4"]: Useful for a "New Arrivals" section.
- [related_products limit="3" columns="3"]: Typically used on single product pages, this shows products related to the one currently being viewed.
- Product categories and tags:
- [product_category category="your-category-slug" per_page="6" columns="3"]: Displays products from a single, specified category.
- [product_categories number="0" parent="0"]: Lists all your top-level product categories. This is great for a dedicated "Shop by Category" page or a sidebar.
- To display products by tag, you'd typically use the tag attribute within the main [products] shortcode, like: [products tag="summer-specials" columns="4"].
Action-Oriented WooCommerce Shortcodes
Beyond displaying information, some WooCommerce shortcodes are designed to prompt specific actions from your customers, directly contributing to conversions.
- Add to cart button/URL: [add_to_cart] and [add_to_cart_url]
The woocommerce add to cart shortcode is useful for creating direct purchase opportunities outside the standard shop or product pages.
[add_to_cart id="99"]: This will display an "Add to Cart" button for the product with ID 99. You can include attributes like show_price="true" or style=";"
[add_to_cart_url id="99"]: This doesn't display a button, but rather outputs the URL that adds product 99 to the cart. Useful for custom-designed buttons or links.
How to use: Embed these on blog posts reviewing a product, on custom landing pages for promotions, or even in email campaigns (using the URL for the link).
- Shop Messages: [shop_messages]
This shortcode is used to display WooCommerce-generated messages (like "Product added to cart," "Coupon applied successfully," etc.) on pages that aren't standard WooCommerce pages. It’s used when building highly customized stores.
5 Tips for Using WooCommerce Shortcodes
Knowing the available WooCommerce shortcodes is not enough—you also need to use them effectively. To get the most out of these handy tools and avoid potential headaches, here are a few practical tips to remember:
Insert your shortcodes properly. Whether you're using the WordPress Classic Editor or Gutenberg, the newer block editor, inserting WooCommerce shortcodes is rather straightforward. In the Classic Editor, you simply paste the shortcode directly into the text area. For Gutenberg users, it's best to use the dedicated “Shortcode” block. This ensures the system correctly interprets and processes it.
Keep an eye on the syntax of attributes. The real power of many WooCommerce shortcodes comes from their attributes (e.g., limit="5", category="apparel"). Pay close attention to the syntax. Always enclose attribute values in straight quotation marks (")—not curly ones (“ ”), which can sometimes sneak in when copying and pasting. Also, double-check that you're using valid values for each attribute as specified by WooCommerce documentation.
Be careful when combining shortcodes. You can often use multiple shortcodes on a single page. However, if it isn't working as expected (e.g., it's displaying as plain text or the layout is broken), first check for typos. Ensure the WooCommerce plugin is active. If issues persist, try deactivating other plugins temporarily to check for conflicts.
Be mindful about the performance. Although shortodes are convenient, don't overuse them. Each one of them requires processing. Using an excessive number of complex WooCommerce shortcodes on a single page can potentially impact load times. While specific data varies, it's a general best practice in web development that pages heavy with dynamic content processing can see an increase in load time.
For ecommerce, even a one-second delay can impact conversion rates—lowering them by 7%. For complex layouts or highly specialized functionality, dedicated page builders or even custom development might offer a better solution.
Test your shortcodes before publishing. This might seem obvious, but it’s a critical step to ensure everything appears and functions exactly as you intend for your visitors. Always preview the page, check the output for accuracy, test any interactive elements (like add-to-cart buttons or forms), and view it on different screen sizes to catch potential display or functionality issues before your customers do.
Beyond Basics: Improve Your WooCommerce Experience with Yespo
WooCommerce shortcodes give you control over how content is displayed and structured within your ecommerce store. But is it enough to drive actual sales? This is where you move beyond static displays towards data-driven customer engagement. While WooCommerce shortcodes help with the what and where of your content, a platform like Yespo helps you with advanced retail marketing strategies.
Yespo is a customer data platform (CDP) designed to help ecommerce store owners to get the most of their customer data and increase sales. And now you can integrate Yespo into your store without much work using our free WooCommerce plugin. Install the plugin, sync store’s data with our system, and begin using amazing new capabilities, including:
AI-powered product recommendations: When the “related products” option is not enough, Yespo’s AI-driven product recommendations is what you need. Analyze customer behavior, their purchase history, and even hidden patterns between your visitors to show the most relevant items, increasing cross-sell and upsell opportunities.
Pinpoint targeting with customer segmentation: Understand your audience on a deeper level. With robust customer segmentation features, you can create highly targeted campaigns that speak directly to individual customer needs and preferences. With Yespo, you can use demographic, geographic, RFM, parametric, and many other types of segmentation for any scenario you might have. And if you’re unsure which one to pick—our powerful predictive segmentation might be exactly what you’re looking for.
Engage your customers with interactive website widgets: Capture their attention and drive meaningful action with interactive widgets on your website. Collect contact data, inform users about the latest deals, offer discounts, or even add games right to your website. No additional coding required!
By combining an effective store design and layout, achieved with smart use of themes and the WooCommerce shortcodes, with Yespo’s personalization capabilities, you create a strong combination. This approach doesn't just look good, but actively works to drive engagement and increase sales.
As we've seen, WooCommerce shortcodes are more than just some text in brackets. It’s a simple but reliable way to customize online stores and improve user experience. From structuring core pages to dynamically displaying your products exactly where and how you want them, they offer control without exceptional technical know-how.
And when you're ready to take your store's performance and personalization to the next level, Yespo CDP might be exactly what you’re looking for. Fill in the form below if you have questions or would like to discuss your specific case.