woocommerce display categories/subcategories/products

一笑奈何 提交于 2020-01-02 05:46:08

问题


is there any way to display the main categories with subcategories and their products in woocommerce? php or shortcode? I've tried with some conditional formatting,but nothing.


回答1:


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.

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



来源:https://stackoverflow.com/questions/15764430/woocommerce-display-categories-subcategories-products

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!