storefront-api-examples
storefront-api-examples copied to clipboard
react-graphql-client: Error message when adding product to cart
Currently, there's an error message when adding a product to the cart:
App.js:136 Uncaught ReferenceError: client is not defined
To fix this issue, in the addVariantToCart function within App.js, add the following:
const client = this.props.client;
and change each this.props.client to client.
I've made the changes on a local branch, but I don't have rights to push branches up for this repository.
@ryangrunest you can fork the repo and then do a PR from there
Pull Request: https://github.com/Shopify/storefront-api-examples/pull/110
To test this issue, I connected to my storefront within src/index.js, and attempted adding a product to the cart.
@swalkinshaw how can i update the existing cart lineitem i can find shopify doc to increase the quantity of product that already in cart Ref: https://shopify.dev/custom-storefronts/cart#increase-an-items-quantity
but i want to add another product in the same cart by using cart id i can see using checkout craete we can use checkoutLineItemsReplace to remove the existing lineitem and replace with new lineitem as like is possible in cart?
Pls reply