From e1bcd1636a21ed7e5f737993d4373cee074b3d07 Mon Sep 17 00:00:00 2001 From: Paul Hachmang Date: Tue, 30 Jun 2026 11:40:25 +0200 Subject: [PATCH] fix(magento-product): count items with no customizable_options as added MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .../add-products-to-cart-empty-customizable-options.md | 5 +++++ .../components/AddProductsToCart/findAddedItems.ts | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 .changeset/add-products-to-cart-empty-customizable-options.md diff --git a/.changeset/add-products-to-cart-empty-customizable-options.md b/.changeset/add-products-to-cart-empty-customizable-options.md new file mode 100644 index 00000000000..33df737ff73 --- /dev/null +++ b/.changeset/add-products-to-cart-empty-customizable-options.md @@ -0,0 +1,5 @@ +--- +'@graphcommerce/magento-product': patch +--- + +Fix the add-to-cart success message counting 0 when the added cart item has no `customizable_options` to match the requested entered/selected options against. `findAddedItems` now falls back to the SKU (+ configurable variant) match instead of dropping the item. diff --git a/packages/magento-product/components/AddProductsToCart/findAddedItems.ts b/packages/magento-product/components/AddProductsToCart/findAddedItems.ts index b798cc8e241..e9b973af69f 100644 --- a/packages/magento-product/components/AddProductsToCart/findAddedItems.ts +++ b/packages/magento-product/components/AddProductsToCart/findAddedItems.ts @@ -48,6 +48,8 @@ export function findAddedItems( } 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 const matchEntered = filterNonNullableKeys(itemVariable.entered_options).every( (requestOption) => customizable_options.find(