My Oracle Support Banner

addItemsToCart not Working when Adding Same Item Names Multiple Times and Error Found in cart.js "Uncaught TypeError" (Doc ID 2601238.1)

Last updated on OCTOBER 21, 2019

Applies to:

Oracle Commerce Cloud Service - Version N/A and later
Information in this document applies to any platform.

Symptoms

ISSUE STATEMENT

addItemsToCart not adding products to cart and errors out when adding same item name multiple times.

ERROR

Uncaught TypeError: Cannot read property '0' of undefined

STEPS TO REPLICATE

The issue can be reproduced at will with the following steps:

1. Created a Page with a Custom Button.

2. Click on this button will load the selected Catalog Products into the cart invoking "addItemsToCart" method.

3. Select Products as below

Product 1 :-

Name -= 5V PANEL

Size Property value = 10ft

Product 2 :-

Name = 5V PANEL

Size property value = 20ft

Note that both the products has the same name but differs in property values.

4. Now click on the Custom button which will further invoke addItemsToCart method.

6. Products not added to the cart and cart.js throwing error, as the Same product names have to be added multiple times.

Changes

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.