I searched for relevant articles before but it could not be applied.

In Woocommerce, I just want to display products in subcategory, not show products in parent category, how to add code in file function.php, Child theme, don't use Cross sell, up sell is available.

For example, the category tree is: Mobile> Apple> Iphone The product is: Iphone 11 I only want Related products in "Iphone 11" products to show "Iphone" category, not show products in "Apple" and "Mobile" categories.

  • Welcome to WordPress StackExchange, what have you try so far? Maybe you can show us your code and then maybe there is a better chance that you will get an answer. How to ask a question
    – user141080
    May 27, 2020 at 19:30

1 Answer 1


Please visit this URL: https://businessbloomer.com/woocommerce-show-product-subcategories/ maybe it will help you.

  • Hi Yash, thanks for your comment. Unfortunately, the code snippet doesn't work on my website. I use the astra theme and elementor plugin to build the site.
    – emptyss
    May 27, 2020 at 3:15
  • Could you please provide a page URL where you want to do this? It will help to solve the same. May 27, 2020 at 7:40
  • Hi Yash, my website is: psi-vn.com/may-nen-khi-truc-vit-eg37. Thanks for your help
    – emptyss
    May 28, 2020 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.