blog Updated

Show Main Products in Listing and Product Detail Page

Learn how to display main products in Shopware 6 listings and on the product detail page, even when variants exist. Includes event subscriber solution.

  • Shopware
  • PHP

If you’ve ever struggled with Shopware’s visibility settings, you know how frustrating it can be. By default, if a product has variants, Shopware hides the main product from category listings and automatically switches the product in the detail page (PDP) to a variant.

I ran into the same problem: I wanted main products to appear in listings and still display the main product on the PDP, even if it had variants, while listing those variants inside the page. At first, it seemed simple, but Shopware’s default behavior makes it more complicated than expected.

The Problems I had

  • Only main products should appear in product listings.
  • When opening a PDP, the main product should load, not a variant.

Default Shopware behavior:

  • Main products are hidden if variants exist.
  • PDPs automatically resolve to a variant.

Even adjusting storefront visibility (Main Product: Everywhere, Variants: Search only) fixes the listing but not the PDP — opening a main product still loads a variant.

Variant storefront presentation for product listing
This screenshot was taken from Shopware 6.7.3.1.

The solution for the Variant listing in the pdp

The fix requires a small plugin using an event subscriber to override Shopware’s variant resolution. The key is the ResolveVariantIdEvent. By hooking into this event, you can set the PDP to display the main product or other product id’s.

Working code example

class ProductPageSubscriber implements EventSubscriberInterface
{
    public static function getSubscribedEvents(): array
    {
        return [
            ResolveVariantIdEvent::class => 'onProductPageLoaded',
        ];
    }

    public function onProductPageLoaded(ResolveVariantIdEvent $event): void
    {
        $event->setResolvedVariantId($event->getProductId());
    }
}

How it works

Shopware normally selects a “best variant” for the PDP if a main product has variants. The subscriber overrides this by setting the resolved product ID to the main product itself.

Notes

  • Storefront visibility settings alone only affect listings, not PDPs.
  • Using ResolveVariantIdEvent is a clean solution without modifying core Shopware files.
  • This method was tested only in Shopware 6.6.10

Shoutout to the helpful user on Discord who guided me toward this solution — it made the process much faster.