0
votes

I have a wordpress website and I have shown product categories on my home page using [product_categories columns="2"] shortcode. What I want is when somebody clicks on one of the product categories, it takes them to the product sub-category may be on separate page and I want the sub-categories to be shown exactly like the parent-categories shown on my homepage.

I have already created the sub-categories in my wordpress admin panel but unable to show them on separate page when somebody clicks on parent category. How to achieve that result ?

1
[product_categories columns="2"] is this shortcode is only showing parent product categories?Rajkumar Gour
@RajkumarGour yes and when somebody clicks on one the categories, I want to show sub-category just like I have shown on my homepageAseem Sharma

1 Answers

0
votes

you can create a taxonomy-product_cat.php file. and where you can get the current category id and use below function to get its clid category

get_term_children( $current_term_id, $taxonomy );

after that you can use clild product category ids to display them

you can use below function to get current product category id

$queried_object = get_queried_object();