Built a Shopware 6 plugin that resolves the best in-stock variant by property position across category listings, search results, manufacturer pages, and PDP. One service, five surfaces, zero inconsistency.
A Shopware 6 store with extensive variant products was displaying inconsistent and often misleading product information across different storefront surfaces. Customers frequently encountered out-of-stock variants in listings while in-stock alternatives existed, eroding trust and causing unnecessary friction.
Each product surface had its own ad-hoc variant handling, creating a fragmented experience where the same product could appear differently depending on how the customer navigated to it. There was no single source of truth for variant resolution.
Built a centralized VariantPreselectionService with DBAL-powered queries that serves as the single source of truth for variant resolution across every product surface.
A reusable DBAL service that selects the best variant per parent product based on property group option position, with language-aware COALESCE fallbacks through the full language chain.
Prioritizes in-stock variants over out-of-stock ones. When no variant is in stock, falls back to the first by position so the display remains deterministic and merchandising-friendly.
Event-based subscribers hook into Shopware's product listing and variant resolution lifecycle to apply the same logic on category, search, manufacturer, PDP, and quote request surfaces.
Enriches every listed variant with a custom stock extension by querying sibling stock via DBAL, so templates can show accurate availability without additional API calls.
Category listings, search results, manufacturer pages, PDP, and quote request forms all resolve to the same best variant using a single service.
Product cards now reflect true availability by checking sibling variant stock, eliminating false out-of-stock signals when alternatives exist.
All variant resolution uses batched DBAL queries grouped by parent ID, avoiding the performance pitfall of per-product database calls.
When a customer explicitly selects a variant through the configurator, the system defers to their choice instead of overriding it with the pre-selected variant.
Variant-heavy catalogs need intelligent display logic to surface the right product at the right time. We build systems that optimize what your customers see.
Get Expert Help from Elixent Digital