Tổng hợp WooCommerce Shortcodes

WooCommerce Shortcodes

WooCommerce shortcodes có thể thêm trực tiếp vào bài viết, trang. Dưới đây là danh sách tổng hợp tất cả WooCommerce shortcodes thường dùng và ví dụ đi kèm rất dễ hiểu.

ShortcodesGiải thích
[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
[add_to_cart id=”99″ style=”border-right:1px solid #ccc”]Show the price and add to cart button of a single product by ID.
[add_to_cart_url id=”99″]Echo the URL on the add to cart button of a single product by ID.
[products tag=”hoodie”]Show Only Products With tag “hoodie”
[product_page id=”99″]Show a full single product page by ID
[product_page sku=”FOO”]Show a full single product page by SKU
[products id=”7, 9, 22, 15, 22, 67″ orderby=”title” order=”desc”]Shows a set of products by ids or skus.
[products limit=”4″ columns=”4″ orderby=”id” order=”DESC” visibility=”visible”]Display the newest products first – four products across one row.
[products limit=”4″ columns=”4″ orderby=”popularity” class=”quick-sale” on_sale=”true” ]Display four random on sale products.
[products limit=”4″ columns=”2″ visibility=”featured” ]Display featured products, two per row, with a maximum of four items.
[products limit=”3″ columns=”3″ best_selling=”true” ]Display three top best selling products in one row.
[product_attribute attribute=”color” filter=”black”]Lists products by attributes.
[featured_products per_page=”12″ columns=”3″ orderby=”date” order=”desc”]Display list of featured products.
[recent_products per_page=”4″ columns=”1″ orderby=”date” order=”desc”]This will show 4 of the most recent products in 1 column, ordered by the date descending.
[products columns=”3″ attribute=”season” terms=”warm” orderby=”date”]In this example, I want three products per row, displaying all of the “Summer” items. That attribute slug is season, and the attribute is warm. I also want them sorted from the newest products to the oldest.
[top_rated_products per_page=”6″ columns=”2″]List the top rated products by reviews.
[sale_products per_page=”12″ orderby=”sale_price” order=”desc”]List all the products that are currently on sale.
[best_selling_products per_page=”8″]Display all the best selling products that are currently on sale.
[related_products per_page=”4″]Display related products.
[product_category category=”truck-parts”]Show multiple products in a certain category based on the arguments provided.
[product_categories number=”0″ parent=”0″]Show Top Level Categories Only
[product_categories number=”12″ ids=”2, 6, 7, 10″]Display multiple product categories.
[shop_messages]Allows you to show WooCommerce notifications (like, ‘The product has been added to cart’) on non-WooCommerce pages.
[woocommerce_product_search]Allows you to insert live search and live filtering facilities inside pages and posts.
[woocommerce_product_filter]This allows you to shows a live Product Search Filter.
[woocommerce_product_filter_attribute]This allows you to shows a live Product Attribute Filter.
[woocommerce_product_filter_category]This allows you to shows a live Product Category Filter.
[woocommerce_product_filter_price]This allows you to shows a live Product Price Filter.
[woocommerce_product_filter_tag]This allows you to shows a live Product Tag Filter.

Shortcode Arguments:

  • per_page – how many products to show per page.
  • columns – The number of columns to put the products in.
  • orderby – You can order the results by title, date, etc.
  • order – Display the results ordered descending or ascending.

Nguồn: https://codeinform.com/

Để lại một bình luận

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *