WooComerce Cart Page Shortcode
[woocommerce_cart] – this transforms your regular page into the cart page for your website. Customers can view a summary of all the products they have added to the cart by visiting this page.
The page displays the list of products added to the cart, a box to enter coupon codes, and a button to proceed to the checkout page.
WooCommerce Checkout Page Shortcode
[woocommerce_checkout] – adds a checkout page to your website. This is an important step in the purchasing process for a customer on your website.
The shortcode adds the necessary fields to enter the billing information as well as allowing the customer to select a payment method to pay for the product.
WooCommerce My Account Shortcode
[woocommer_my_account] – creates a user account dashboard page on the website. On this page, the customer can view all of their account information, change the password, update their billing information, view past order details, and so on.
By default, it will display the last 15 orders, but you can change this by adding an argument to the shortcode [woocommerce my account order count=”10″]. To display all previous orders, enter -1.
WooCommerce Order Tracking Form Shortcode
[woocommerce_order_tracking] – This adds a form to the website where a customer can enter his order ID and obtain shipping information for that order.
WooCommerce Shortcodes for Shop Page
[products] – This is the most widely used shortcode in WooCommerce. This shortcode is used on the shop page to display all products in the store.
You can add additional arguments to this shortcode to make it more specific.
Let’s try to understand the product attributes with an example.
|limit||[products limit=”4″]||This will limit the number of products to be displayed to just 4.|
|columns||[products column=”3″]||This will display products in 4 columns on the desktop view. On mobile and tablet mode, the numbers will reduce.|
|category||[products category=”organic”]||This will display products from specific categories that are mentioned. You can add more than one category separated by a comma.|
|paginate||products limit=”9″ paginate=”true”]||This adds pagination to the product page. It has two values – |
|orderby||[products orderby=”rating”]||You can use this argument with a number of values to order your products in many ways.|
|order||[products order=”ASC”]||This lets you sort the products in ascending (|
|tag||[products tag=”honey, tea”]||Display products of specific tags. Add multiple tags separated by a comma.|
|sku||[products skus=”honey-white-small, tea-black”]||Display products any adding specific SKUs separated by a comma.|
|on_sale||[products on_sale=”true”]||Display only products that are on sale. Like paginate, it also has two values – |
|best_selling||[products best_selling=”true”]||Display the best selling products. The available options are |
|top_rated||[products top_rated=”true”]||Display products that have received the highest ratings. The available options are |
If you set up attributes, you can use them in the shortcode to get even more specific results. An example of an attribute is the size or color.
|attribute||[products attribute=”pack-size”]||Display products containing specific attribute.|
|terms||[products attribute=”pack-size” terms=”1KG”]||Display products with more specificity by adding terms that are linked to the attribute.|
WooCommerce Shortcodes for Product Categories
There are two main shortcodes available for the WooCommcer categories. You can further narrow down the result by using different arguments.
[product_category] – This shortcode will display products from a specific category. Example – [product_category category=”honey”] will only display products from the honey category.
[product_categories] – This will display all categories of your store on a single page.
To narrow down the results, you can add specific arguments to it. The arguments that work with it are:
|ids||[product_categories ids=”112,114″]||Display specific categories by mentioning their ids.|
|limit||[product_categories limit=”4″]||Limit the number of categories displayed.|
|columns||[product_categories columns=”4″]||Sets the number of columns that will be used to display the categories.|
|hide_empty||[product_categories hide_empty=”1″]||Two values work for this argument. “|
|parent||[products_categories parent=”1”]||You can use this shortcode in two ways. Specify the category id to display all child categories of that specific category. Set the id to “0” to display all top-level categories.|
|orderby||[products_categories order=”name”]||Display categories based on “|
|order||[products_categories orderby=”ASC”]||Display the categories in ascending or descending order based on |
That’s it for the category shortcodes. Let’s now check some of the other useful WooCommerce shortcodes.
WooCommerce Related Products Shorcode
[related_products max_count=”4″] Displaying related products on the product page is a great way to increase sales. You can do so by using the shortcode provided above.
WooCommerce Single Product Page Shortcode
[product_page id”12″] – You can display the single product page by specifying the “
id“, or “
WooCommerce Add to Cart Button Shortcode
[add_to_cart id=”14″] – Display Add to Cart button for any product by mentioning its post ID. You use this shortcode on any page, post, or widget. If you want to display the price of the product next to the button, you can add
show_price="TRUE" before the close bracket.
WooCommerce Add to Cart URL
[add_to_cart_url id=”99″] – This shortcode displays the actual URL of a specific product. You can use either “id” or “SKU” to target the product.
WooCommerce Shop Message Shortcode
[shop_messages] – WooCommece displays certain notification messages on the website. You can add this shortcode to display notifications such as the “This product has been added to your cart”.
That’s it! These are the several shortcodes that WooCommcerce natively supports.
To avoid any issue, let’s take a look at some of the possible errors that may occur.