Magento - Stop child products showing in anchor category

Magento - Stop child products showing in anchor category

August 20, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento - Stop child products showing in anchor category

Dealing with Child Products on Magento Anchor Categories

In your Magento setup, you’re facing an issue where child products are being displayed within an anchor category page, which isn’t appropriate for your specific use case. You want to filter out these child products and only show the ones directly contained within the current category.

Understanding the Challenge

Your initial approach of filtering in the view.phtml template is a good starting point, but it has its limitations. This method filters the display of items but doesn’t touch the underlying data structure or layered navigation functionality. As a result, you end up with “ghost” products that aren’t displayed but are still counted and create inconsistencies.

The core issue lies in Magento’s hierarchical category structure and how it handles product assignment across multiple levels. When a product is assigned to a parent category, it becomes visible in all child categories as well due to the recursive nature of the category tree.

Why a Core Rewrite Might Not Be Necessary

While you’ve assumed that a core rewrite would be required to solve this issue (possibly by modifying an index process), I want to assure you that there are more efficient and less invasive solutions available. A core rewrite can introduce unnecessary complexity, maintenance overhead, and compatibility issues with future Magento updates.

The key is to leverage the existing Magento features and configuration options to achieve your desired outcome without touching the core codebase directly.

Step 1: Understand the ‘Visibility’ Attribute

Every product in Magento has a ‘Visibility’ attribute that determines where the product appears in the frontend. By default, this is set to “Catalog, Search” for most products. This means they appear both in category listings and search results.

Step 2: Adjust Product Visibility Settings

To prevent child products from appearing within their parent categories, you can adjust their ‘Visibility’ settings:

  1. Navigate to the Magento backend.
  2. Go to Catalog > Products.
  3. Search for or filter by the desired child product(s).
  4. Click on the selected product.

In the “Edit Product” page under the General section, you’ll see the “Visibility” field. Change the default setting from “Catalog, Search” to one of these options:

  • Not Visible Individually: This hides the product in all frontend listings except for those it’s directly assigned to.
  • Search: This makes the product visible only in search results and not in category listings.

Step 3: Fine-tune the Category Display Settings

Additionally, you can configure your anchor categories to display only parent products:

  1. Go to Catalog > Categories.
  2. Find the desired anchor category.
  3. Under “Display Settings”, set “Is Anchor” to Yes.
  4. Set “Include in Menu” to No.

These settings ensure that your anchor category behaves as intended—only displaying the products directly assigned to it and excluding any child products that may be visible elsewhere.

Conclusion

In summary, you don’t need a complex core rewrite to solve this issue. By leveraging Magento’s built-in ‘Visibility’ attribute and adjusting product and category display settings, you can achieve your desired outcome of showing only direct parent products within an anchor category.

This approach is not only more straightforward but also ensures the stability and compatibility of your Magento installation with future updates and patches.

For a deeper dive into Magento customization and optimization techniques, I recommend checking out our Magento Development Services page at Laravel Company. Our team of experienced Magento developers can help you tackle even the most challenging e-commerce projects with ease and efficiency.

Catalog Indexing Themes Configuration

Our network