Skip to content

fix(magento-product): count items with no customizable_options as added#2641

Open
paales wants to merge 1 commit into
canaryfrom
fix/find-added-items-empty-customizable-options
Open

fix(magento-product): count items with no customizable_options as added#2641
paales wants to merge 1 commit into
canaryfrom
fix/find-added-items-empty-customizable-options

Conversation

@paales

@paales paales commented Jun 30, 2026

Copy link
Copy Markdown
Member

Problem

The add-to-cart success snackbar reports "0 products added" for products whose backend consumes the submitted entered_options/selected_options into its own field instead of echoing them back as Magento customizable_options.

findAddedItems matches each submitted cartItem against the returned cart by SKU and requires every requested entered/selected option to round-trip through the cart item's customizable_options. When a backend integration (for example a 3D configurator that persists its state in a custom cart field) leaves customizable_options empty, that match fails, the — in fact added — item is dropped from addedItems, and <Plural value={addedItems.length}> renders the other ("0 products") branch.

Products that submit no entered_options (the common configurable/simple case) are unaffected, because the match is vacuously true for them.

Fix

When the cart item carries no customizable_options, there is nothing to match the requested options against — so accept the SKU (+ configurable variant/options) candidacy already established earlier in the function rather than dropping the item.

const { customizable_options } = cartItem
// No customizable_options to match against — trust the SKU candidacy rather than drop the item.
if (customizable_options.length === 0) return true

Notes

  • Behaviour is unchanged whenever the cart item does expose customizable_options (the existing strict entered/selected matching still runs).
  • Found while integrating a custom configurator on a GraphCommerce storefront; verified end-to-end that the success message now names the added product instead of "0 products".

The add-to-cart success snackbar reported "0 products added" for products whose
backend consumes the submitted entered_options/selected_options into its own
field instead of echoing them as Magento customizable_options (e.g. a
configurator that persists its state in a custom cart field). findAddedItems
required every requested option to round-trip through customizable_options, so
such an item — though added — was dropped from addedItems and the plural
rendered the "0 products" branch.

When the cart item carries no customizable_options there is nothing to match the
requested options against, so accept the SKU (+ configurable variant) candidacy
already established above instead of dropping the item.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e1bcd16

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

This PR includes changesets to release 86 packages
Name Type
@graphcommerce/magento-product Patch
@graphcommerce/magento-graphcms Patch
@graphcommerce/magento-open-source Patch
@graphcommerce/magento-storyblok Patch
@graphcommerce/docs Patch
@graphcommerce/browserslist-config-pwa Patch
@graphcommerce/changeset-changelog Patch
@graphcommerce/eslint-config-pwa Patch
@graphcommerce/graphql-codegen-markdown-docs Patch
@graphcommerce/graphql-codegen-near-operation-file Patch
@graphcommerce/graphql-codegen-relay-optimizer-plugin Patch
@graphcommerce/misc Patch
@graphcommerce/next-config Patch
@graphcommerce/prettier-config-pwa Patch
@graphcommerce/typescript-config-pwa Patch
@graphcommerce/address-fields-nl Patch
@graphcommerce/algolia-categories Patch
@graphcommerce/algolia-insights Patch
@graphcommerce/algolia-personalization Patch
@graphcommerce/algolia-products Patch
@graphcommerce/algolia-recommend Patch
@graphcommerce/algolia-search Patch
@graphcommerce/cli Patch
@graphcommerce/demo-magento-graphcommerce Patch
@graphcommerce/ecommerce-ui Patch
@graphcommerce/framer-next-pages Patch
@graphcommerce/framer-scroller Patch
@graphcommerce/framer-utils Patch
@graphcommerce/google-datalayer Patch
@graphcommerce/google-playstore Patch
@graphcommerce/googleanalytics Patch
@graphcommerce/googlerecaptcha Patch
@graphcommerce/googletagmanager Patch
@graphcommerce/graphcms-ui Patch
@graphcommerce/graphql-mesh Patch
@graphcommerce/graphql Patch
@graphcommerce/hygraph-cli Patch
@graphcommerce/hygraph-dynamic-rows-ui Patch
@graphcommerce/hygraph-dynamic-rows Patch
@graphcommerce/hygraph-ui Patch
@graphcommerce/image Patch
@graphcommerce/lingui-next Patch
@graphcommerce/magento-cart-checkout Patch
@graphcommerce/magento-cart-coupon Patch
@graphcommerce/magento-cart-email Patch
@graphcommerce/magento-cart-items Patch
@graphcommerce/magento-cart-payment-method Patch
@graphcommerce/magento-cart-pickup Patch
@graphcommerce/magento-cart-shipping-address Patch
@graphcommerce/magento-cart-shipping-method Patch
@graphcommerce/magento-cart Patch
@graphcommerce/magento-category Patch
@graphcommerce/magento-cms Patch
@graphcommerce/magento-compare Patch
@graphcommerce/magento-customer Patch
@graphcommerce/magento-graphql-rest Patch
@graphcommerce/magento-graphql Patch
@graphcommerce/magento-newsletter Patch
@graphcommerce/magento-payment-adyen Patch
@graphcommerce/magento-payment-afterpay Patch
@graphcommerce/magento-payment-braintree Patch
@graphcommerce/magento-payment-included Patch
@graphcommerce/magento-payment-klarna Patch
@graphcommerce/magento-payment-multisafepay Patch
@graphcommerce/magento-payment-paypal Patch
@graphcommerce/magento-payment-tokens Patch
@graphcommerce/magento-product-bundle Patch
@graphcommerce/magento-product-configurable Patch
@graphcommerce/magento-product-downloadable Patch
@graphcommerce/magento-product-grouped Patch
@graphcommerce/magento-product-simple Patch
@graphcommerce/magento-product-virtual Patch
@graphcommerce/magento-recently-viewed-products Patch
@graphcommerce/magento-review Patch
@graphcommerce/magento-search-overlay Patch
@graphcommerce/magento-search Patch
@graphcommerce/magento-store Patch
@graphcommerce/magento-wishlist Patch
@graphcommerce/mollie-magento-payment Patch
@graphcommerce/next-ui Patch
@graphcommerce/react-hook-form Patch
@graphcommerce/service-worker Patch
@graphcommerce/storyblok-ui Patch
@graphcommerce/framer-next-pages-example Patch
@graphcommerce/framer-scroller-example Patch
@graphcommerce/image-example 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

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
graphcommerce-246 Ready Ready Preview Jun 30, 2026 9:44am
graphcommerce-247 Ready Ready Preview Jun 30, 2026 9:44am
graphcommerce-hygraph-dynamic-rows-ui Ready Ready Preview Jun 30, 2026 9:44am
graphcommerce-open-source Ready Ready Preview Jun 30, 2026 9:44am
graphcommerce-storyblok Ready Ready Preview Jun 30, 2026 9:44am

Request Review

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