Skip to content

Conversation

@jorgemoya
Copy link
Contributor

@jorgemoya jorgemoya commented Jan 20, 2026

What/Why?

Filter out child cart items (items with parentEntityId) from cart and cart analytics to prevent duplicate line items when products have parent-child relationships, such as product bundles.

Simplified this implementation over #2726 because it's not easy to know which CartSelectedMultipleChoiceOption from the product options/modifiers has attached this child product to the parent item, so we would get duplicate information (in the product options list, shown below, as well as a separate product item below the parent product). I opted for less duplication and code simplicity.

Testing

Screenshot 2026-01-20 at 3 09 56 PM

Migration steps

Step 1: GraphQL Fragment Updates

The parentEntityId field has been added to both physical and digital cart item fragments to identify child items.

Update core/app/[locale]/(default)/cart/page-data.ts:

  export const PhysicalItemFragment = graphql(`
    fragment PhysicalItemFragment on CartPhysicalItem {
      entityId
      quantity
      productEntityId
      variantEntityId
+     parentEntityId
      listPrice {
        currencyCode
        value
      }
    }
  `);

  export const DigitalItemFragment = graphql(`
    fragment DigitalItemFragment on CartDigitalItem {
      entityId
      quantity
      productEntityId
      variantEntityId
+     parentEntityId
      listPrice {
        currencyCode
        value
      }
    }
  `);

Step 2: Cart Display Filtering

Cart line items are now filtered to exclude child items when displaying the cart.

Update core/app/[locale]/(default)/cart/page.tsx:

  const lineItems = [
    ...cart.lineItems.giftCertificates,
    ...cart.lineItems.physicalItems,
    ...cart.lineItems.digitalItems,
- ];
+ ].filter((item) => !('parentEntityId' in item) || !item.parentEntityId);

Step 3: Analytics Data Filtering

Analytics data collection now only includes top-level items to prevent duplicate tracking.

Update core/app/[locale]/(default)/cart/page.tsx in the getAnalyticsData function:

- const lineItems = [...cart.lineItems.physicalItems, ...cart.lineItems.digitalItems];
+ const lineItems = [...cart.lineItems.physicalItems, ...cart.lineItems.digitalItems].filter(
+   (item) => !item.parentEntityId, // Only include top-level items
+ );

Step 4: Styling Update

Cart subtitle text color has been updated for improved contrast.

Update core/vibes/soul/sections/cart/client.tsx:

-                  <span className="text-[var(--cart-subtext-text,hsl(var(--contrast-300)))] contrast-more:text-[var(--cart-subtitle-text,hsl(var(--contrast-500)))]">
+                  <span className="text-[var(--cart-subtext-text,hsl(var(--contrast-400)))] contrast-more:text-[var(--cart-subtitle-text,hsl(var(--contrast-500)))]">
                     {lineItem.subtitle}
                   </span>

@changeset-bot
Copy link

changeset-bot bot commented Jan 20, 2026

🦋 Changeset detected

Latest commit: 48a5426

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bigcommerce/catalyst-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jan 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
catalyst Ready Ready Preview, Comment Jan 20, 2026 9:14pm

Request Review

@jorgemoya jorgemoya marked this pull request as ready for review January 20, 2026 21:24
@jorgemoya jorgemoya requested a review from a team as a code owner January 20, 2026 21:24
@jorgemoya
Copy link
Contributor Author

@andrewreifman Let me know what you think about this. I kind of took #2726 and simplified it. More info on the PR description. I updated the contrast of the product subtitled as requested.

@andrewreifman
Copy link
Contributor

@andrewreifman Let me know what you think about this. I kind of took #2726 and simplified it. More info on the PR description. I updated the contrast of the product subtitled as requested.

I think this definitely looks better than the previous PR. Looking at all that info displayed, I'm not loving the labels and values all being displayed together, but I think for the sake of this PR we can leave it as is. I still want to rethink/redesign the cart so we can make more changes to it in the future.

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.

3 participants