WOOCOMMERCE最常用的短代码
2022-04-26
浏览次数 : 208
Every time we are going to build an E-Commerce store with WooCommerce we all need to use shortcode.
Basic Store setup shortcode
We need put this shortcode to different pages and then those pages are ready to link with WooCommerce pluginPage Shortcode
[woocommerce_cart] – shows the cart page
[woocommerce_checkout] – shows the checkout page
[woocommerce_my_account] – shows the user account page
[woocommerce_order_tracking] – shows the order tracking form
MarkupCopy
Product page shortcode
With this shortcode we can show different type of product on any page as we wantProduct Shortcode
[featured_products]
[sale_products]
[best_selling_products]
[recent_products]
[product_attribute]
[top_rated_products]
[best_selling]
[on_sale] MarkupCopy
Product shortcode attribute
There is an opportunity to customize how your product appears on the page. You just need to put some extra value with your past shortcode.
If you want to display one row with 4 product
[products limit="4" columns="4" orderby="popularity" class="quick-sale" on_sale="true" ]
MarkupCopy
If you want to display my featured products, two per row, with a maximum of four items.
[products limit="4" columns="2" visibility="featured" ]
MarkupCopy
Newest Products
If you want to display the newest products first – four products across one row.
To accomplish this, we’ll use the Post ID (which is generated when the product page is created), along with the order and order by command.
Since you can’t see the Post ID from the frontend, the ID#s have been superimposed over the images.
[products limit="4" columns="4" orderby="id" order="DESC" visibility="visible"]
MarkupCopy
Specific Categories
If you only want to display hoodies and shirts, but not accessories. I’ll use two rows of four.
[products limit="8" columns="4" category="hoodies, tshirts" cat_operator="AND"]
MarkupCopy
Paginations
Display product with pagination. 4 product per page
[recent_products limit="12" columns="4" paginate="true"]