Closed seanbrookes closed 5 years ago
@seanbrookes Good question - currently, we need to store the full reference to the variant in the cart, since it's only persisted through localStorage. As a result, all the variant information needs to be available locally, since there's no requests being made to Shopify for additional info. We're currently working on improving the API that backs the SDK to support carts. Once that happens, we'll be able to save just a variant ID, and retrieving the cart would include all necessary information.
Does that help clarify things?
Yes thanks, it makes sense now why I wasn't seeing expected network traffic when interacting with the SDK methods.
Any idea what kind of timeline for enhanced cart support in the SDK?
I still think there should be a sanity check on the variant value passed in addToCart to avoid false positives.
When I passed a serialized variant object to the addToCart method it returned a cart with a lineItemCount that indicated the variant had been added to the cart but the lineItems was empty. And the checkoutUrl didn't work
JSON parsing the string sorted it out:
It feels a bit awkward passing the whole variant object to addToCart in the first place.
Would it not be possible to pass a variant.id value instead?