Skip to content

Instantly share code, notes, and snippets.

@deadlyhifi
Last active June 23, 2022 07:42
Show Gist options
  • Save deadlyhifi/5b7115d79e610f125a3c to your computer and use it in GitHub Desktop.
Save deadlyhifi/5b7115d79e610f125a3c to your computer and use it in GitHub Desktop.
Have WooCommerce use only the subcategory a product is in for related products (not parent category)
@jodzeee
Copy link

jodzeee commented Dec 20, 2020

@m16averick - It's not working for me, but I have hierarchal categories. Can it be made to work that way or with tags?

@Maurizio288
Copy link

I tested the code on my site.
I see no effect on how it works in related products. Probably because all the products also have the "Uncategorized" category. Should the code be changed to remove this category from the search for related products?

I'm using the DIVI theme, I don't wish it was a DIVI problem. What do you think?

Thanks

@itsprabhucbe
Copy link

I find this plugin which is suitable for our requirement - Related Products for WooCommerce by WebToffee,
After installing the plugin you can able to display products based on category and tags. If you want to display products based on sub-category follow this tutorial. https://www.webtoffee.com/related-products-woocommerce-user-guide/#sub_category

@ngoduyangit
Copy link

I find this plugin which is suitable for our requirement - Related Products for WooCommerce by WebToffee, After installing the plugin you can able to display products based on category and tags. If you want to display products based on sub-category follow this tutorial. https://www.webtoffee.com/related-products-woocommerce-user-guide/#sub_category

Thanks alot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment