Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UpdateItem with quantity undefined does not leave quantity as-is #215

Open
GorgonFreeman opened this issue Oct 11, 2021 · 0 comments
Open

Comments

@GorgonFreeman
Copy link

Hey! I'm John from Createur and I'm using updateItem as part of a function to ensure line item properties are attached to all cart items before the checkout.

As a result, all we're trying to do is add or change properties on the item. According to the docs, leaving quantity as undefined would be good for this, and the items would be otherwise unaffected - but I'm finding that quantity is set to 1 for that item instead.

This happens both using line index and ID, and seems to be behaviour straight through from the Shopify cart API, although not explicitly stated.

You can try this out on Sandler:

  1. Visit the site
  2. CartJS.addItem(39335042547784, 4);
  3. CartJS.updateItem(1, undefined); or use the cart API

If others agree, I would suggest changing the CartJS documentation to reflect this.

In terms of a fix, I'm wondering what the best way to go about passing through the existing quantity where none is provided would be?

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

No branches or pull requests

1 participant