E-commerce UX

Shopware variant pre-selection: always show the in-stock variant first

Shopware 6 plugin that resolves the best in-stock variant across listings, search, manufacturer pages, and PDP. One service, no N+1 queries.

Industry:
E-commerce
Project Type:
Plugin Feature
Duration:
2 weeks
Location:
Germany
Published:
Outcome
5
Surfaces unified
Real time
Stock awareness
0
N+1 queries
1
Source of truth

The Challenge

A Shopware 6 store with hundreds of variant products kept showing customers the wrong thing. A red out-of-stock variant in the listing while three colours sat on the shelf. Quote forms returning the parent product instead of the variant the customer actually clicked.

Critical Pain Points

  • Listings and search showed arbitrary variants, often out of stock
  • Manufacturer pages displayed parent products and broke the visual flow
  • PDPs ignored merchandising preferences set through property group order
  • Stock badges were wrong because cards saw individual variants without sibling context
  • Quote requests resolved to parent products and pulled wrong cover images

Every product surface had its own ad-hoc variant logic. Customers saw a different "best variant" on every page. Trust drained one click at a time.

The Solution

I built one variant resolution service that every product surface routes through. One source of truth, one set of rules, one consistent answer.

One service, every surface

Listings, search, manufacturer pages, PDPs, and quote forms all call the same resolver. Whatever logic changes in one place, every surface picks it up.

Stock-aware by default

In-stock variants come first. If nothing is in stock, the first variant by position wins so the display stays predictable.

Position-aware merchandising

Property group ordering becomes a real merchandising lever. The variant with the highest priority that's also in stock wins.

Sibling stock enrichment

Listings know whether any sibling variant has stock, so card badges show real availability instead of one variant's status.

Results & Business Impact

Same product, same answer everywhere

Category listings, search results, manufacturer pages, PDP, and quote forms all show the same best variant. Customers never see two versions of the same product on one site.

Honest stock badges

Cards say in-stock when any sibling is in stock and out-of-stock only when nothing is. False alarms gone.

No N+1 query penalty

Variant resolution is batched per parent ID with DBAL queries. Performance scales with catalogue size, not with surface count.

Customer choice still wins

When a customer picks a specific variant on the PDP, the system steps aside. Pre-selection only applies before the customer chooses.

Technologies Used

  • Shopware 6
  • PHP 8
  • Symfony
  • DBAL
  • Twig
  • MySQL
  • Event Subscribers

Variants showing the wrong product?

If your storefront resolves variants differently on every surface, customers feel the inconsistency before you do. I can fix that. Let's talk.

Book a consultation

Share this case study

Found this interesting? Share it with your network