I’m trying to create page with all categories from parent category, and for this I’m using this shortCode in my tamplate shop:
echo do_shortcode( '[product_categories]' );
I can show all categories of my shop, but i want to show all categories of parent category.
I’m reading in google an woocommerce documentation, but with this short-code, generate URL of this category, but i do click in category redirect to home page.
How do i can to do page of specifies category. For example, if i want enter in category
music load template with this products…
I need create a function in functions.php ? or if i use shortcode I can?
my actual result it´s:
and URl for one category it´s, for example:
But this return to home
I’m noob with WooCommerce. Any help is appreciated.
[product_categories] shortcode you’re using can accept a number of arguments, one of which is parent:
Set to a specific category ID if you would like to display all the child categories. Alternatively, set to “0” (like in the example below) to show only the top level categories.
Pass in the current category ID as the parent attribute and your shortcode will only list out child categories.
If you need to get the current category (WP_Term) when you’re viewing one of these pages, use
Having re-read your question, it sounds like you may be asking to display products from a given category instead. Should that be the case, use the
[product_category] shortcode instead.
echo do_shortcode( [product_category category="CATEGORY-SLUG"] );
[product_category] will default to showing a maximum of 12 products (