Hi,
does Snipcart.api.cart.items.add still support an array of products?
It throws an error whenever I try to pass an array…
Cheers,
Andrea
Hi,
does Snipcart.api.cart.items.add still support an array of products?
It throws an error whenever I try to pass an array…
Cheers,
Andrea
Hi @azicchetti
Yes this is still supported, can we see the error and your code to see if something is off.
Thanks!
Hi @dominic,
I’m attaching a screenshot of a test call in the developer console, as you can see, it seems to be ignoring the array.
As a temporary fix, I’m looping with a serialized promise.
Thank you,
Andrea
Hi @azicchetti,
Instead of an array, it takes multiple products separated by a comma. Here is an example:
Snipcart.api.cart.items.add({
id: 'PRODUCT_ID',
name: 'Product 1',
price: 1.11,
url: '/',
quantity: 1,
},{
id: 'PRODUCT_ID',
name: 'Product 1',
price: 1.11,
url: '/',
quantity: 1,
})
Thank you lea, I totally misinterpreted the documentation!
Would be great if the doc could be updated with function signatures, just to be on the safe side.
Thanks again,
Andrea