Shortcodes let you display specific content on the pages of your online store. The content could be anything- from displaying products to checkout page- depends on what action you want your visitors to perform.
Woocommerce comes with a list of shortcodes that allows you to customize your pages/posts by displaying products/product categories, and much more. So, instead of simply adding links to your product pages, etc., you can display product, set of products, and product categories on your blog posts as per your requirement by using a shortcode with an argument.
One of the many cases, when shortcodes are helpful, is when you are launching a new product and want to make your visitors aware of the product through a blog post. You can add the product to the blog post to improve your odds of selling.
Using shortcodes to add a product to blog posts
To add a product to a blog post using a shortcode, add the shortcode with an argument.
In this case the argument is “sku”.
”global_data_unlimited-15” is the product sku
You can also add the product by using the product ID.
The relevant product has been added to the blog page at the bottom.
Likewise, you can add shortcodes to display pages, products categories, product page, related products, and add to cart to any page/post of your website by using the following shortcodes.
Woocommerce shortcodes for pages
Your cart is currently empty.
|None||shows the cart page|
|None||shows the checkout page|
|None||shows the user account page|
|None||shows the order tracking form|
Other Woocommerce shortcodes
|featured_products||per_page, columns, orderby, order||Shows featured products|
|product||id or sku||Shows a single product|
|product_page||id or sku||Shows details of a product|
|product_category||per_page, columns, orderby, order, category||Shows products in a category|
|product_categories||number, orderby, order, columns, hide_empty, parent, ids||Shows existing product categories|
|add_to_cart_url||id or sku||Displays the URL of the “add to cart” button of a product|
|add_to_cart||id or sku, style||Displays price and the “add to cart” button of a product|
|sale_products||per_page, columns, orderby, order||Display products on sale|
|top_rated_products||per_page, columns, orderby, order||Shows top-rated products|
|best_selling_products||per_page, columns||Displays best selling products|
|product_attribute||per_page, columns, orderby, order, attribute, filter||Shows products with an attribute|
|related_products||per_page, columns, orderby||Displays related products|