Woocommerce Shortcodes explained - SkillBakery Studios


Post Top Ad

Post Top Ad

Friday, November 27, 2020

Woocommerce Shortcodes explained

 WooCommerce shortcodes let you display information from your shop in your required manner. WooCommerce comes pre-built with shortcodes, and you can install plugins to add more. Whether you want to list products in a table, display the cart anywhere on your site, or something else – you’ve come to the right place!

You’ve probably come across shortcodes before, whether you’re new to WordPress or have been using it for some time. Shortcodes are, as the name suggests, short pieces of code that perform some sort of function. WooCommerce shortcodes, for example, let you add neat WooCommerce-related functions to WordPress pages, posts, sidebars, and widgetized areas on your website. You can use WooCommerce shortcodes to display a list of your top rated products on your homepage. Showcase related products whenever a customer expresses an interest in a product, and many other great things.

How to use WooCommerce shortcodes

Simply insert the shortcode into any text editor within WordPress, or to a ‘Shortcode’ block if you’re using Gutenberg or a page builder such as Elementor or Visual Composer: like shown in given screenshot

WooCommerce products shortcode

WooCommerce has a shortcode that lets you list specific products in a grid layout: [products ids="83,68,70,66,64,62"] . You can also add other parameters to it (such as orderby and columns) to customize the front-end appearance.

You can choose the number of products to list per row. For example, if you wanted to display six products in three columns ordered by date in ascending order, you would use the shortcode: [products ids="83,68,70,66,64,62" orderby="date" columns="3" order="ASC"] 

WooCommerce add to cart shortcode

WooCommerce comes with a built-in [add_to_cart] shortcode which lets you insert an add to cart button for a specific product anywhere you like. Simply add the ID and/or SKU of the product you want to display the add to cart button for: [add_to_cart="68"] If you want to include the product price, then use: [add_to_cart="68" show_price="true"]

WooCommerce product category shortcode

The Product category shortcode lists products from a specific category in a standard grid layout. The shortcode for the same is [product_category category="clothing" per_page="12" columns="4" orderby="default" order="asc" operator="in"]

WooCommerce recent product shortcode

The Recent products shortcode displays the products you’ve recently added to your your shop. The shortcode for it is 
[recent_products per_page="8" columns="4" orderby="date" order="ASC"].

There are many such shortcodes which you can find out in official documentation of woocommerce. In the next post we will dicuss about woocommerce page shortcodes, and how to set them up.

No comments:

Post a Comment

Post Top Ad