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 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.
This is mainly used on shopping cart page. It shows cart product and also gives option to add coupon code.
This code is usually used on cart page, which shows complete method of checkout.
This is useful for customers after making purchase. Using it customers can track their product.
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.
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.
This is used to show add to cart button on single product, id of an product can be added here.
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.
This will list all products on a page, here you can define number of product at a time.
Product which is highest sold can be shown using this code, here you can also set number of product for a page.
This will show top rated product on sales page.
Used to show link of “Change Password”
This will display a link of lost password. On clicking of it you will get a lost password form.
Displays Logout Link.