Woo-Commerce

As woo-commerce comes with many shortcodes which can be used in various places according to our requirements, So this post will give you some important shortcodes which can be used for making our shopping website perfect.
Before coming to shortcodes lets learn how to use a code in the editor and in a php file.

In Editor:-

  • In editor you need to simply put your shortcode in “text” section of editor, It can be used in both “Pages” as well as “Posts”.
  • The best practice to put code is copy given code and paste by pressing ‘Ctrl/cmd+shift+v’.

In php File:-

  • In php file you need to use do shortcode function. Suppose you want to add code for Woo-Commerce Checkout page then use.


Now we have learned how to use shortcode, so lets proceed with shortcode which can be used.

WooCommerce Shortcodes:-

[woocommerce_cart]

This is mainly used on shopping cart page. It shows cart product and also gives option to add coupon code.

[woocommerce_checkout]

This code is usually used on cart page, which shows complete method of checkout.

[woocommerce_order_tracking]

This is useful for customers after making purchase. Using it customers can track their product.

[woocommerce_my_account order_count="12"]

Used to show customers account, users can track their previous orders on their account page. Here order number can be fixed using “order_count” this will show number of orders in a page at a time.
If it is left blank then 15 product can be shown. This is default value.

[recent_products per_page="12" columns="4"]

Recent products can be shown by this code, also number of products and column can be set by given arguments ‘per_page’ and ‘columns’ respectively.

[featured_products per_page="12" columns="4"]

Working of this short code is same as recent product, only difference in this code is, it displays only those products which is set as featured product. Arguments will work in same manners.

[product id="99"]

This will show product by its ‘id’. You will get id of product when you add it in dashboard.

[products ids="1, 2, 3, 4, 5"]

This is the extended version of previous code.
It shows multiple products at a time, you need to just put the product id separating by comma.

[add_to_cart id="99"]

This is used to show add to cart button on single product, id of an product can be added here.

[product_page id="99"]

This will show all product of a single category on a page. Before that you need to create a category and that category must be assigned on particular products, which you want to show.

[sale_products per_page="12"]

This will list all products on a page, here you can define number of product at a time.

[best_selling_products per_page="12"]

Product which is highest sold can be shown using this code, here you can also set number of product for a page.

[top_rated_products per_page="12"]

This will show top rated product on sales page.

[woocommerce_change_password]

Used to show link of “Change Password”

[woocommerce_lost_password]

This will display a link of lost password. On clicking of it you will get a lost password form.

[woocommerce_logout]

Displays Logout Link.

Here I conclude my all the points, I am sure this will help you. Give your valuable feedback.