Skip to content

STS-3.0.1: collapse variant groups to a single item in listings & counts - #36

Open
gi-os wants to merge 2 commits into
feat/product-variants-3.0.0from
claude/variant-grouped-counts
Open

STS-3.0.1: collapse variant groups to a single item in listings & counts#36
gi-os wants to merge 2 commits into
feat/product-variants-3.0.0from
claude/variant-grouped-counts

Conversation

@gi-os

@gi-os gi-os commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Variant sets (a product offered in multiple sizes/colors) were counting and listing once per variant folder. A single sneaker in 7 sizes showed as "7 products" and rendered 7 cards in overviews. This collapses each variant group to a single item everywhere.

Changes

  • New lib/variants.ts — shared, fs-free helpers:
    • dedupeVariantGroups(products) → one representative per variant group
    • countDistinctProducts(products) → grouped count
  • Applied to: homepage collection cards (app/page.tsx), collections overview (app/collections/CollectionCard.tsx), shop-all, and refactored the collection detail page to use the shared helper (it already grouped inline).
  • Version bump STS-3.0.1 (lib/version.ts, package.json, VERSIONING.md).

Result

Sneakers (7 sizes) now shows 1 product; a shirt in S/M/L/XL shows 1. Non-variant products are unaffected. Verified live on a 3.0.0 shop.

Giovanni Lupo added 2 commits July 1, 2026 18:23
…ounts

Adds lib/variants.ts with dedupeVariantGroups() and countDistinctProducts()
helpers. Variant sets (e.g. sizes/colors) now render as one product card and
count as one item on the homepage, collections overview, collection detail,
and shop-all pages, instead of once per size/color folder.
Listing cards (shop-all, homepage single-collection) now display the variant
group base name (e.g. "Branded Sneakers") instead of a single variant folder
name ("Branded Sneakers (10)"), and render the available values as chips
below via a shared components/VariantChips.tsx, matching the collection detail
page. Adds variantDisplayName() to lib/variants.ts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant