fbpx
wordpress woocommerce shortcode

Everything About WooCommerce Shortcodes

Want to insert a live product search within a blog or webpage? Simple, just use WooCommerce shortcodes. In short, this WooCommerce feature allows you to display your online store information such as your top-selling products, displaying the shopping cart, and much more differently.

Here’s everything that you need to know about WooCommerce plugin shortcodes.

What are Shortcodes?

As the name suggests, a shortcode is a snippet of code that is used to perform a specific action. Shortcodes are commonly used in WordPress and can be placed anywhere on a WordPress webpage, post, or within a widget.

In WordPress, shortcodes follow the same simple format where a short piece of text is placed within two brackets. Here’s how: [shortcode]

Shortcodes are also used in various WordPress plug-ins and themes. In this case, the shortcode is prefaced by the name of the plug-in or theme. For example: [plugin_shortcode]

Now that you know what shortcodes are, let’s move on to understanding shortcodes in WooCommerce.

What are WooCommerce Shortcodes?

WooCommerce shortcodes are designed to work with the WooCommerce plug-in. Shortcodes provide a simple way to insert WooCommerce-related functionalities into any WordPress page or post. 

Shortcodes can be used to display several WooCommerce-related functionalities such as:

  • Products
  • Shopping cart
  • Checkout page
  • User account
  • Order tracking

To display a WooCommerce shortcode, you need to preface the shortcode with “woocommerce.” For example: [woocommerce_cart] demonstrates the user’s shopping cart. On a similar note, [woocommerce_checkout] displays the store’s checkout page.

Now, let us look at why WooCommerce shortcodes are important for eCommerce store owners?

Why Should You Use WooCommerce Shortcodes?

WooCommerce shortcodes are the easiest way to customize or bring a “fresh” look to your WooCommerce store. For example, you can add your “top selling products” to your homepage or pages where interested shoppers visit your store. WooCommerce shortcodes can also be used to facilitate the user’s shopping experience on your online store. For example, an “Add to Cart” button can be placed on any product page to make it easier for the shopper to buy that product.

In short, WooCommerce shortcodes can be used to optimize your online store for better customer experience and improve conversions and revenues.

How Do WooCommerce Shortcodes Work?

As mentioned before, a WooCommerce shortcode is a short snippet of text separated by underscores. While some of the WooCommerce shortcodes can function on their own, other shortcodes require additional parameters. Effectively, parameters are extra lines of code that are used to make the action more specific. For instance, if you add the parameter on_sale=”true” to a product shortcode, only products that are available for sale will be displayed.

Here are some more examples of WooCommerce shortcodes with parameters:

  • [products limit="10" columns="5"]

This will show a total of 10 products in a grid format with 5 columns.

  • [product_categories ids="90, 105, 140"]

This is used to display all the specified product categories.

  • [add_to_cart id="454"]

This is used to display an “Add to Cart” button for the product with the specified product ID.

  • [best_selling_products per_page="10" columns="2"]

This will display your 10 top-selling products in a grid with two columns.

Next, let us see how you can get a WooCommerce shortcode for your WordPress website.

How Can I Get WooCommerce Shortcodes?

For WordPress users, there are many plug-ins available to install a WooCommerce shortcode. However, the best mode of getting a WooCommerce shortcode feature is by installing the WooCommerce Shortcodes plug-in. This WooCommerce Shortcodes plugin is available for WordPress 3.9 (or later) and WooCommerce 2.0 (or later).

Once this plug-in is installed and activated, you can use a “TinyMCE” drop-down list to choose any of the available shortcodes. From your WordPress admin account, search for the “WooCommerce Shortcodes” plug-in and install it on your website.

Next, let us look at how to insert a WooCommerce shortcode.

How to Insert WooCommerce Shortcodes?

After you have installed this plug-in, you can now view a new WooCommerce shortcode button in your page editor. On clicking this button, you can view the list of WooCommerce shortcodes. Click any of the available options to add it as a shortcode. For instance, you can insert the following WooCommerce shortcodes for products:

  • Price/cart button

    WooCommerce Shortcodes

    product price cart button

  • Add to cart URL
  • By SKU/ ID

Featured Product

For instance, the Price/cart button is used to display the price and the “Add to Cart” button of any product (based on the specified ID or SKU). On clicking this button, you can specify the product ID in the pop-up box, and then click OK to insert the shortcode. Here is the shortcode that appears for a product with ID 25:

[add_to_cart id="25"]

To add your shortcodes on the WordPress webpage, you need to first publish the page from your page editor. Now, let us look at a complete list of WooCommerce shortcodes that you can use for your WordPress website. 

List of All WooCommerce Shortcodes

Here is the complete WooCommerce shortcodes list that you can use for your website:

WooCommerce Shortcode Description
[woocommerce_cart] Adds the WooCommerce cart functionality with all the products added by the user to their shopping cart. This shortcode does not need any additional parameters.
[woocommerce_checkout] Displays the checkout page with information such as the billing address, shipping address, and order details. Even this shortcode does not need any additional parameters.
[woocommerce_my_account] Displays the user’s account information including name, email address, and password change. You can also add the customer’s previous order details. This shortcode does not need any additional parameters.
[woocommerce_order_tracking] This shortcode creates an Order Tracking page with the current status of the orders. No additional parameters are required for this shortcode.
[woocommerce_product_search] This shortcode creates a search and filtering facility on the current page. It requires no additional parameters.
[products] Among the widely used shortcodes, this displays all the offered products. With this shortcode, you can add the “category” parameter to display products from the specified category. Additionally, you can use the “limit” parameter to limit the number of products being displayed.
[products_categories] This shortcode can be used to display all your product categories on a single page. This shortcode does not have any additional parameters.
[products_category] This is used to display a particular category or selected categories. You can also use the following parameters with this shortcode:

  • Ids: to display categories by their IDs.
  • Limit: to specify how many categories to display.
  • Columns: to specify the number of columns in the grid layout.
[add_to_cart] To create the “Add to Cart” button for a particular product, additional parameters include:

  • Id: to specify the product based on its product ID.
  • Sku: to choose the product based on its SKU.
  • Show_price: to configure if the product price must also be displayed. Value can be either true or false.
  • Quantity: to set the product quantity to be added to the cart. The default value is 1.
[add_to_cart_url] To display the URL of the product. It can use only two parameters namely id and sku.
[shop_messages] This shortcode displays messages or notifications. For example, “This product has been added to your cart.”
[recent_products] This displays all the products that have been added recently to the shop. Additional parameters include “per-page” to specify the number of recent products to be displayed on each page.
[featured_products] To display all your favorite products with the highlighted “star” icon. It uses the same parameters as [recent_products].
[sale_products] To display all products that are currently available on sale.
[best_selling_products] To display all your best-selling products.
[top_rated_products] To display all the products that have gained the best ratings from customers.
[related_products] To display the list of related products.

 

Conclusion

In short, WooCommerce shortcodes are an effective mode of improving the functionality of your WooCommerce store and adding to the user experience. The best part is that shortcodes are flexible enough to be added anywhere including shopping pages, posts, blogs, or even sidebars.

Do you want to leverage the use of WooCommerce shortcodes on your store but are not sure how to? Flipper Code can help you. We have the expertise to elevate your WooCommerce development. If interested, request a quote today.