Skip to content

WooCommerce Shortcodes: Optimise your WordPress Shop

Alejandro Frades
Shortcodes de WooCommerce_ Optimiza tu tienda en WordPress

!
Creating an efficient and attractive online store with WordPress and WooCommerce can be an exciting challenge. A key tool for achieving this are WooCommerce shortcodes, short codes that simplify the addition of functionalities and custom content on your site. In this article, we will explore the most useful WooCommerce shortcodes and how they can transform your online store.

What are WooCommerce shortcodes?

WooCommerce shortcodes are snippets of code that allow you to insert various store functions and elements into your pages and posts. These shortcuts are an integral part of WooCommerce and allow from displaying specific products to completing the checkout process, all by simply adding a simple code in your WordPress editor.

Key WooCommerce Shortcodes

  1. Cart ([woocommerce_cart]): This shortcode displays the shopping cart. It is essential in any online store and is usually automatically added in the initial WooCommerce setup.
  2. Checkout Process ([woocommerce_checkout]): Like the cart, this shortcode is vital as it displays the checkout process, making it easy for customers to complete their purchases.
  3. Order Tracking ([woocommerce_order_tracking]): This code allows your customers to track the status of their orders, improving user experience and trust in your store.
  4. My Account ([woocommerce_my_account]): Displays the customer’s account section, where they can review previous orders and update their information.
  5. Featured Products ([featured_products]): An excellent way to highlight certain products in your store, displaying them in the location you want.

Other Shortcodes

  1. [woocommerce_cart]: Displays the shopping cart page.
  2. [woocommerce_checkout]: Displays the checkout process page.
  3. [woocommerce_my_account]: Displays the user’s account page, including previous orders and account details.
  4. [woocommerce_order_tracking]: Allows users to track their orders via a form.
  5. [products]: A versatile shortcode for listing products. It can be filtered by post ID, SKU, categories, attributes, with options for pagination, random order, and more.
  6. [recent_products]: Displays the most recent products in your store.
  7. [featured_products]: Displays products that have been marked as featured.
  8. [sale_products]: Lists products that currently have discounts.
  9. [best_selling_products]: Displays the best-selling products in your store.
  10. [top_rated_products]: Lists the best-rated products.
  11. [product_category]: Displays products from a specific category.
  12. [product_categories]: Displays all your product categories or a specific subset.
  13. [product_page]: Displays a single product page by ID or SKU.
  14. [product]: Displays a single product by ID or SKU.
  15. [add_to_cart]: Displays the price and button to add a specific product to the cart.
  16. [add_to_cart_url]: Displays the URL of the button to add a specific product to the cart.
  17. [related_products]: Displays a list of products related to the current one.
  18. [shop_messages]: Displays store messages, such as order confirmations or add-to-cart notifications.
  19. [product_attribute]: Displays products that have a specific attribute.

These shortcodes can be modified with various arguments to customize their operation, such as limiting the number of products displayed, defining the number of columns, sorting by date, popularity, etc.

Advanced Customization with Shortcodes

To make the most of the advanced customization that WooCommerce offers through its shortcodes, it is essential to understand how you can manipulate and combine different options to suit your specific needs. The shortcode [products] is particularly versatile in this sense. Let’s see how you can use it to customize your store in creative and effective ways:

Advanced Use of the Shortcode [products]

  1. Filtering by Categories and Tags: You can display products from specific categories or with certain tags. For example, [products category="clothes, accessories"] will show products that belong to both the “clothes” and “accessories” categories. Likewise, [products tag="eco-friendly"] will display products tagged as “eco-friendly”.
  2. Order and Sorting: The orderby attribute can be used to define the sorting criteria for the products. Options include date (publication date), title (title), popularity (popularity), rating (rating), and rand (random). In addition, you can use order to define whether the order is ascending (ASC) or descending (DESC).
  3. Show On-Sale or Popular Products: Use attributes like on_sale="true" to show products that are currently on sale, or best_selling="true" to show the best-selling products. This is useful for highlighting special offers or customer favorites.
  4. Limit the Number of Products and Column Configuration: With limit and columns, you can control how many products are displayed and how they are distributed on the page. For example, [products limit="4" columns="2"] will show four products in two columns.
  5. Products by Specific Attributes: If your products have custom attributes (such as size, color, season), you can display products that match these specific attributes using attribute and terms.

Creative Combinations of Shortcodes

Creating interesting and useful combinations of shortcodes in WooCommerce allows you to make the most of the flexibility and potential of your online store. Here are some ideas for combinations of shortcodes that could be useful and attractive for different purposes in your WooCommerce store:

1. Display New and On-Sale Products

[products limit="4" columns="4" orderby="date" order="DESC"]
[sale_products limit="4" columns="4"]

This combination will first show the four most recent products and then four products on sale, each in a four-column grid.

2. Best-Selling and Top-Rated Products

[best_selling_products per_page="5" columns="5"]
[top_rated_products per_page="5" columns="5"]

This combination is excellent for showing first the five best-selling products and then the five top-rated products in your store.

3. Featured Products by Category

[products limit="6" columns="3" category="clothes" visibility="featured"]
[products limit="6" columns="3" category="accessories" visibility="featured"]

With this combination, you can display six featured products from the “clothes” category followed by six featured products from the “accessories” category.

4. Random Selection and On-Sale Products

[products orderby="rand" limit="6" columns="3"]
[sale_products per_page="6" columns="3"]

First, display a random selection of six products, which can add dynamism to your store, followed by six products on sale.

5. Combination of New Products and by Attribute

[recent_products per_page="4" columns="4"]
[products attribute="color" terms="blue" per_page="4" columns="4"]

This combination is useful for first showing the most recent products and then specific products that match a particular attribute, such as blue color.

6. Products by Tag and Custom Products

[products tag="eco-friendly" limit="4" columns="4"]
[products ids="101, 102, 103" columns="3"]

Implementation in Pages and Posts

To implement these shortcodes, simply go to the WordPress editor of the page or post where you want them to appear. In the block editor, add a shortcode block and paste the code. In the classic editor, you can insert it directly into the body of the text.

Conclusion

WooCommerce shortcodes are a powerful tool for customizing and optimizing your online store on WordPress. From highlighting specific products to creating custom layouts, these shortcodes give you full control over the appearance and functionality of your store. Whether you use the basic shortcodes or venture to create your own, you can enhance your customers’ shopping experience and increase conversions. Make the most of these tools and watch your online store stand out and thrive in the competitive world of e-commerce. Make your store unique and successful with WooCommerce shortcodes!

Frequently Asked Questions

How can I customize my store with advanced shortcodes?

You can use the [products] shortcode to display products based on categories, tags, popularity, or randomly. This gives you total control over which products to highlight in your store.

Is it difficult to create my own shortcodes?

At first, it may seem challenging, but with practice and understanding of WooCommerce, creating custom shortcodes becomes manageable. We recommend learning how for advanced customization.

How will I improve my store using WooCommerce shortcodes?

By using shortcodes, you can highlight products, offer promotions, and improve navigation. This creates an attractive shopping experience that can increase conversions and the success of your online store.

Autor
Alejandro Frades
Marketing Specialist
The mind behind Modular's social content. Always on top of the latest trends to take advantage of them and make the digital world more enjoyable and entertaining.

Subscribe to our Newsletter about the web world