WooCommerce Shortcode 101: Everything You Need to Know

WooCommerce Shortcode 101: Everything You Need to Know

WooCommerce offers a myriad of built-in shortcodes or little bits of code that produce content and complete actions on your website. Many of these ready-to-use shortcodes have extraordinary power for adding elements like Add To Cart buttons and product details on any post or page.

In this WooCommerce shortcode guide, we cover all the shortcodes available for your online store, along with guidelines on how to add them.

? Table of contents:

What’s a WordPress/WooCommerce shortcode?

Shortcodes look like this:

[this_is_a_shortcode]

Except, you would change the text within those brackets to specify what you’d like the shortcode to do.

However, you can’t simply type in whatever you want; there are specific shortcodes that work across WordPress and within the WooCommerce plugin.

For instance, one default shortcode that comes with WooCommerce is:

[products]

This shortcode pulls a gallery of products from your store and displays them on the page or in a post where you placed the shortcode.

WooCommerce shortcodes either:

  • Generate essential actions/content on your ecommerce store, such as sending a customer to the Checkout page

Or…

  • Allow store owners to place ecommerce content anywhere on their site, such as inserting a product gallery with Buy Now buttons on a blog post

If you want to set up your store and insert products in your content, understanding WooCommerce shortcodes is important.

WooCommerce is moving away from shortcodes (but they’re still important)

While understanding WooCommerce shortcodes is still important for getting the most from your store, it’s worth noting that the WooCommerce team is trying to move away from shortcodes in favor of blocks.

Since the launch of the block editor (AKA Gutenberg) in WordPress 5.0, WooCommerce has been slowly but surely creating dedicated blocks for a lot of the functionality that you could previously only access through shortcodes.

Many of these blocks are now available in the core WooCommerce plugin. If you want even more options, the official WooCommerce Blocks plugin gives you access to all the blocks that WooCommerce is experimenting with.

? If you want to learn more, check out our WooCommerce blocks tutorial.

However, the WooCommerce block system still isn’t as comprehensive as the existing shortcodes, so understanding WooCommerce shortcodes is still important.

Plus, if your site still uses the Classic TinyMCE editor, you’ll need to rely on shortcodes as WooCommerce blocks don’t work with the Classic editor.

How to use WooCommerce shortcodes

WooCommerce will automatically add some shortcodes when setting up your store, typically for key pages such as the cart and checkout.

To add

[…]

 



This article was written by Joe Warnimont and originally published on ThemeIsle Blog.

Disclosure: Some of the links in this post are "affiliate links." This means if you click on the link and purchase the product, We may receive an affiliate commission.

Leave a Comment

You have to agree to the comment policy.

Show Your ❤️ Love! Like Us
Scroll to Top