WooCommerce Shortcodes – .com

In this tutorial we will see all the shortcodes (short codes) that WooCommerce brings by default, what they are for and how to use them correctly.

What are shortcodes?

In case you are not familiar with shortcodes, we are going to define them quickly. A shortcode or short code is simply a word in square brackets, like this:

Sometimes the shortcode can have an opening and closing tag, like this:

And in many cases it can also have parameters, like so:

The magic of this bracketed word is that you just type it into the WordPress editor, and when someone looks at it on the web, it automatically turns into other content. An image, a text, a product, a post, a loop… anything.

For example, if I write “nvideos” in square brackets in the editor, this becomes the number of videos there are, or 6044.

If you want to know more about shortcodes, take a look at the lesson of the .

So, let’s see what shortcodes come standard with WooCommerce, and what they “turn” into when someone sees them on the web.

1. WooCommerce Page Shortcodes

These 4 shortcodes are a bit special, because they match the 4 pages that WooCommerce creates. These shortcodes are usually The only thing What is on each of those pages:

  • – Displays the “Cart” page.
  • – Shows the payment page.
  • – Shows the status of the order.
  • – Displays the “My Account” page.

As WooCommerce automatically generates these pages, it is most likely that we will not have to use them in life, because once it has been established, we should never touch it again.

See also  Customize Storefront using fonts from Google Fonts - .com

2. WooCommerce Product Shortcodes

Although WooCommerce already has the one that shows all products, sometimes we want to show only some products on any page or entry.

Let’s start with the easiest. Show a specific product, on any page or post, with this shortcode:

We can indicate the product that we want to show both by its “id” and by its “sku”, for example:

  • – Product with “id” 123
  • – Product with the reference ref.abc

This will show only the product itself, but if we want we can show whole whole page of the product, with the following shortcode:

  • – Product page with “id” 123
  • – Product page with the reference ref.abc

As you can see, so far we have only shown one product, singular. But we can also show a list of products. For this we have the following shortcodes:

  • – List of the 3 products 123, 124 and 125.
  • – List of the latest products.
  • – List of featured products.
  • – List of discounted products.
  • – List of best-selling products.
  • – List of the best valued products.
  • – List of related products.

Apart from the lists that WooCommerce proposes to us, we can also create our own lists from the classification that we have of categories or attributes.

At the category level, we can show both the products of a category and the categories themselves. Let’s start by showing the products of a category specific. We will do it with this shortcode:

  • – List of products in the “Appliances” category.

And if what we want to show is a list of the product categories that we have in the store, we can do it with this other shortcode:

  • – List of store categories.
See also  Manage your online reputation - .com

Another way to classify and display products is through attributes. We will achieve it through this shortcode:

  • – List of black products

All product listing shortcodes have two very interesting attributes called “orderby” and “order”:

  • the attribute “orderby” It allows us to indicate the criteria with which we want to order the products. We have the following options:
    • menu_order: The number that has been chosen in the product sheet
    • title: The name of the item, alphabetically
    • date: The product release date
    • rand: Random order
    • id: The product identifier
  • the attribute “order” It allows us to choose between ascending or descending order of the previous criteria.
    • asc: Ascending order
    • download: Descending order

Let’s see some examples:

  • : It will show the products of the “clothing” category ordered by date, from the oldest to the newest.
  • : Will display the best selling products in random order.
  • : Will display the most recent products in reverse order by name.

3. Cart Shortcodes

Finally, we have the cart shortcodes. These are very interesting, because they allow us to create the typical “Add to cart” button for any product. We have two variations: Button and URL.

  • – This shortcode will show a button to add product 123 to the cart, wherever we are.
  • – This shortcode will show a url that if it is visited, it will add the product 123 to the cart.

These are great for , since in any article we write on our blog, we can place a link that directly puts any product in the cart. And that is to make the client’s job much easier.

See also  WordPress Hooks - .com

Summary and conclusion

WooCommerce comes with a collection of handy shortcodes that allow us to display pages, products, and add to cart buttons wherever we want.

Thanks to these shortcodes we can incorporate products within our content created for inbound marketing, so that we will not only have them in the store, but we can incorporate them throughout our website.

If you want to know more about the inline CTAs and content marketing, take a look at the . If you subscribe you will have access to both that and the rest of .

Loading Facebook Comments ...
Loading Disqus Comments ...