WordPress Tutorial Videos by WP101®

175+ WordPress tutorial videos for non-techies.

  • About Us
    • Top WordPress Products
    • Testimonials
  • WordPress Tutorials
    • Intro to WordPress
    • WordPress 101
    • AIOSEO 101
    • WP Mail SMTP 101
    • Easy Digital Downloads 101
    • WPCode 101
    • WP Simple Pay 101
    • RafflePress 101
    • Elementor 101
    • WPForms 101
    • Spectra 101
    • How to Blog Better
    • WooCommerce 101
    • Beaver Builder 101
    • Ninja Forms 101
    • WP Rocket 101
  • Help Forum
    • Hire a WordPress Expert
  • Blog
  • Contact
  • Sign In

How to show Related Products from the same subcategory in WooCommerce?

Get answers to your WordPress questions!

Tired of wasting time scouring Google for answers to your WordPress questions? Since 2008, we've helped countless WordPress site owners just like you get unstuck. Get answers to your WordPress questions — plus unlimited access to our entire library of 150+ WordPress tutorial videos. Why not join us today?

View Membership Options
WordPress Questions and Answers › How to show Related Products from the same subcategory in WooCommerce?
0 Vote Up Vote Down
Martin Roberts asked 5 years ago

Every now and then, you come across an issue SO apparently simple you think you have to be stupid not see the answer and then it turns out – there isn't an answer. This is my query.

Is there a way to have Related Products in WooCommerce only display products from a specific subcategory?

Here's the issue.

I have a parent category, “MAKE UP” with 8 subcategories. As far as I can tell, the default Related Products will generate products randomly from both parent and child categories. This is crazy.

The parent category is only broadly related to its children, so showing “related” products from the parent category for products in the child category is unhelpful... to the point of being downright confusing.

I found a plugin called, WooCommerce Custom Related Products Pro. (Note the 'Pro'. Yes, I paid for it.) It works, BUT there's no global settings which means you have to manually add subcategories by product.

I only have 78 products in my shop so far but at around 1 min per product, that's 1 hour & 18 minutes of work!

I used the excellent WP All Import plugin to do the heavy lifting of product amendments, but the WooCommerce Custom Related Products Pro fields don't appear in the import.

It seems SO basic that I have to believe that I'm being stupid! Is there any way to set global parameters for Related Products?

Love to know!
Martin

1 Answers
0 Vote Up Vote Down
Shawn Hesketh answered 5 years ago
Hi Martin, First of all, you're not alone. You're not the first person to encounter this seemingly obvious need. As you stated, WooCommerce determines whether products are “related” in three ways: Up-Sells, Cross-Sells, or by sharing the same tags or categories. And by “categories,” that can mean parent or child categories. This page on the WooCommerce website contains the documentation on how to manually select products to up-sell or cross-sell. But you're asking how to automatically suggest Related Products from the same subcategory. The first method is to use a plugin... which you tried. In addition to the plugin you suggested, there is a free version called, “WPC Custom Related Products for WooCommerce”. While the plugin gives you the ability to manually select related products, it doesn't handle this automatically. Honestly, if it only took you an hour or so to do this for your existing products, and then for each new product as you create them, that may be time well spent, and the easiest method of solving this problem! But you can modify WooCommerce's default behavior, using a bit of code. Here's a function that someone wrote to do just this exact thing: https://gist.github.com/deadlyhifi/5b7115d79e610f125a3c Please note that I have not tested this code snippet. If you have any issues using it, you'll need to reach out to the author of the snippet for help. You can add code like the above snippet to your child theme’s functions.php file or via a plugin like the Code Snippets plugin. Avoid adding custom code directly to the functions.php file in your parent theme, as it will be overwritten whenever you update the theme. Finally, if you're not comfortable editing the underlying code that powers your site, you can always hire a WooCommerce developer to tackle this minor change for you in less than an hour. You can start a conversation with an expert right here: https://wp101.com/help/ I hope this helps!

Please login or register to join the conversation!

Share this with someone?

FacebookTweetLinkedIn

Most Recent Questions

  • I took the Sprectra 101 course. Now I’m building my won web site but I still have the Specra Style Guide and I think it’s causing an issue with Sprectra One. How do I get rid of the Style guide? asked by Mallis01, 1 year ago
  • Can you offer any tips, or best practices, on how to redesign and upgrade an old website? asked by FSAuthor, 1 year ago
  • How to create a blog in Spectra? asked by TJ, 1 year ago
  • How do I make all the words show Uppercase? asked by iLoveToLiveWell.com, 1 year ago
  • Why does my right side dashboard top look different than course. asked by Blues1947, 2 years ago

Site Links

  • About Us
  • Your Account
  • Products We ❤️
  • Affiliates
  • Testimonials
  • Blog
  • Contact Us

Courses

  • WordPress 101
  • WooCommerce
  • Elementor
  • Spectra
  • WPForms
  • Ninja Forms
  • View All →

Products

  • WP101.com
  • WP101 Plugin
  • Embed our videos on your site!

Recent Posts

  • Shared Hosting vs. VPS vs. Managed WordPress Hosting: What Beginners Need to Know
  • All in One SEO Review 2025: Pros, Cons & Real Results
  • 7 Best Small Business Web Hosting Services (Expert Picks)
  • 10 Best SEO Rank Tracking Tools: Features, Tips & Hidden Gems
  • How to Install a WordPress Theme (Complete Step-by-Step Tutorial)

Connect with Us

  • Email
  • Facebook
  • Twitter

WordPress Tutorials by WP101© 2008-2025 WP101® LLC. All rights reserved.
WP101® is a registered trademark with the U.S. Patent and Trademark Office.
WP101® is hosted by SiteGround.
Privacy Policy | Terms of Use | Disclosure | WP101 Coupon