YBO Subjects Related Products
Overview
YBO Subjects Related Products is a specialist WooCommerce plugin developed by YBO Digital to improve the relevance and consistency of the related-products section displayed on product pages.
WooCommerce normally identifies related products through shared product categories and tags. On educational, toy and specialist retail websites, a product may belong to several different category structures at the same time, including Subjects, Brands, Ages and broader catalogue groupings. Standard related-product matching can therefore return products that share a Brand or Age category but are not closely connected to the educational Subject of the product being viewed.
YBO Subjects Related Products replaces this broad matching process with controlled matching inside the configured Subject product-category tree. It starts with the most specific Subject assigned to the current product and, where required, broadens gradually through the Subject hierarchy until enough suitable products are found.
The plugin does not alter products, category assignments, stock records or catalogue data. It controls only the related-product IDs returned to WooCommerce for display.
Why This Plugin Exists
Related Products Can Be Too Broad
Products in a WooCommerce catalogue are often assigned to several categories for navigation, filtering, merchandising and search-engine optimisation.
A product may simultaneously belong to:
- A Brand category
• An Age category
• A Subject category
• A product-type category
• A general promotional or catalogue category
WooCommerce’s default matching can use these shared relationships collectively. This may produce related products that are technically connected through a category or tag but are not contextually useful to the customer.
Educational Subject Hierarchies Require More Precise Matching
Educational and learning-product catalogues commonly use a structured Subject hierarchy, for example:
- Subject
• Mathematics
• Number Skills
• Addition and Subtraction
The most useful related products are normally those found at the deepest assigned Subject level. When that level contains too few products, the logical fallback is to move upward to the parent Subject rather than search across unrelated Brand, Age or catalogue categories.
YBO Subjects Related Products applies this hierarchy-aware approach automatically.
Narrow Categories May Not Contain Enough Products
Highly specific Subject categories can contain only a small number of products. Restricting related products to the deepest category alone may leave the related-products section incomplete or empty.
The plugin can broaden the search one Subject parent at a time. This preserves relevance while allowing WooCommerce to fill the required number of related-product positions where suitable products exist elsewhere in the same Subject branch.
Unrelated Fallback Products Can Be Misleading
When no suitable Subject match exists, automatically reverting to unrelated WooCommerce suggestions may weaken the usefulness of the product page.
The plugin allows administrators to choose what should happen when:
- A product has no Subject category assigned
• A product has a Subject category but no eligible matches are found
Each situation can either preserve WooCommerce’s default behaviour or display no related products.
How The Plugin Works
Step 1 – Resolve The Subject Root
The plugin identifies the WooCommerce product-category root that represents the Subject hierarchy.
It can automatically detect a top-level category named or slugged Subject or Subjects. Administrators can instead select one or more specific Subject roots in the plugin settings.
This prevents the matching process from entering Brand, Age or other unrelated product-category trees.
Step 2 – Identify The Product’s Assigned Subject Terms
When WooCommerce requests related products, the plugin examines the product categories assigned to the current product.
Only categories located within the configured Subject tree are considered. All other product categories are ignored for related-product matching.
Step 3 – Select The Deepest Subject Level
Where a product has more than one Subject term assigned, the plugin identifies the deepest assigned level within the Subject hierarchy.
This most specific Subject level becomes the first matching tier because it normally represents the closest relationship between products.
Step 4 – Find Eligible Products At The Deepest Level
The plugin searches for other WooCommerce products within the selected Subject term.
The current product is excluded, together with any additional product IDs excluded by WooCommerce. Products hidden from the catalogue are also excluded.
Depending on the configured stock policy, the plugin can either:
- Return only products currently marked in stock
• Follow WooCommerce’s normal product-visibility and stock rules
Step 5 – Broaden Through Parent Subject Levels
When hierarchy fallback is enabled and the deepest Subject level does not provide enough products, the plugin broadens the search upward one parent level at a time.
Products already selected are not repeated. The search remains inside the configured Subject tree throughout the process.
This allows the related-products section to remain focused while still drawing from a wider but logically connected Subject area when required.
Step 6 – Apply The Selected Ordering
Administrators can control how eligible related products are ordered.
Available ordering methods include:
- Random
• Product title
• Publication date
• WooCommerce menu order
• Product popularity
Ascending or descending order can be selected where applicable.
When a deliberate non-random order is used, the plugin prevents WooCommerce from reshuffling the final results.
Step 7 – Return The Final Product IDs To WooCommerce
The completed product list is returned through WooCommerce’s supported related-products system.
WooCommerce, the active theme or a compatible page builder remains responsible for rendering the products. The plugin therefore works with the standard WooCommerce related-products template rather than creating a separate front-end product layout.
Related Product Controls
Subject Root Selection
Administrators can use automatic Subject-root detection or select one or more explicit WooCommerce product-category roots.
Multiple roots are supported for catalogues that maintain more than one controlled Subject structure.
Hierarchy Fallback
Hierarchy fallback can be enabled or disabled.
When enabled, the plugin starts with the deepest Subject level and broadens upward only when more products are required.
When disabled, matching remains limited to the deepest assigned Subject level.
Product Count And Columns
By default, the plugin respects the product count and column settings supplied by WooCommerce, the active theme or the page builder.
Administrators can optionally override these values and enforce a specific number of related products and display columns.
Stock Handling
The plugin can be configured to:
- Include in-stock products only
• Follow the standard WooCommerce stock and catalogue-visibility behaviour
Missing Subject Behaviour
When a product has no category inside the configured Subject tree, administrators can choose to:
- Preserve WooCommerce’s normal related products
• Display no related products
No-Match Behaviour
When a Subject is assigned but no eligible products can be found, administrators can choose to:
- Display no unrelated products
• Revert to WooCommerce’s default related-product results
The recommended default is to display no unrelated products where a valid Subject has been assigned but no appropriate Subject match exists.
Product Diagnostics
The plugin includes a read-only diagnostic tool for testing individual products before or after configuration changes.
An administrator can enter a WooCommerce product ID or SKU and review:
- The detected Subject root categories
• The product’s assigned Subject terms
• The deepest Subject terms selected
• The parent fallback tiers that will be searched
• The final related-product IDs and product names
• The reason no products were returned, where applicable
Diagnostics do not change the product or its related-product data. They provide a transparent view of how the matching rules are being applied.
YBO Apps Integration
YBO Subjects Related Products is available beneath the shared WordPress administration menu:
YBO Apps → Subjects Related
The tabbed administration interface separates:
- Overview and operating status
• Matching and fallback settings
• Product diagnostics
The plugin also registers itself with the shared YBO Apps overview so that it remains accessible alongside other YBO-developed WordPress plugins from one central administration area.
Performance and Safety Considerations
YBO Subjects Related Products is designed to operate only when WooCommerce requests related products for display.
The plugin:
- Does not change product category assignments
• Does not create or delete products
• Does not alter product stock
• Does not write related-product selections into product records
• Excludes the current product from its own related-product results
• Respects WooCommerce exclusion IDs
• Excludes products hidden from the catalogue
• Uses controlled, sanitised administration settings
• Provides nonce-protected, capability-restricted diagnostics
• Uses WooCommerce’s supported related-product filter rather than replacing front-end templates
WooCommerce HPOS and Cart and Checkout Blocks compatibility are declared because the plugin does not access or modify WooCommerce order-storage data.
Recommended Configuration And Testing
Before relying on the plugin in production:
- Confirm that WooCommerce is active.
- Open YBO Apps → Subjects Related.
- Confirm that the correct Subject root has been detected or select it manually.
- Decide whether parent-level fallback should be enabled.
- Confirm the stock and ordering settings.
- Review the behaviour selected for products with no Subject or no Subject matches.
- Use Diagnostics to test representative products from the deepest and highest Subject levels.
- Check the related-products section on the front end using the active theme or page-builder layout.
Testing should include:
- A product assigned to a deep Subject level with several direct matches
• A product that requires parent-level fallback
• A product assigned to more than one Subject term
• A product with no Subject assignment
• A Subject product with no eligible matching products
• A product with out-of-stock or catalogue-hidden potential matches
Requirements
The plugin requires:
- WordPress 6.2 or later
- PHP 7.4 or later
- WooCommerce
The plugin requires WordPress, WooCommerce and a structured WooCommerce product-category hierarchy containing the relevant Subject categories.
Support
YBO Subjects Related Products is a custom-developed WooCommerce merchandising plugin by YBO Digital.
Support requests:
support@ybo.digital