简体   繁体   English

woocommerce显示类别/子类别/产品

[英]woocommerce display categories/subcategories/products

is there any way to display the main categories with subcategories and their products in woocommerce? 有没有办法在woocommerce中显示子类别及其产品的主要类别? php or shortcode? PHP或短代码? I've tried with some conditional formatting,but nothing. 我试过一些条件格式,但没有。

You have two default shortcodes available to display both, product categories (with a specific parent category defined, to display subcategories,) and products contained inside a specific category. 您有两个默认短代码可用于显示两者,产品类别(定义了特定父类别,显示子类别)和特定类别中包含的产品。

To display top-level categories use the shortcode: 要显示顶级类别,请使用短代码:

[product_categories parent="0"]

If you want to display subcategories, include the category ID inside the parent attribute. 如果要显示子类别,请在父属性中包含类别ID。

To display products inside a category: 要在类别中显示产品:

[product_category category="category-slug-here"]

Full reference for this shortcodes: product categories shortcode and products in category shortcode 此短代码的完整参考: 产品类别短代码类别短代码 产品

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM