Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Hello guys!
Recently, I've integrated a cart API via storefront on my service.
For example, I've implemented create and get cart methods:
https://shopify.dev/api/storefront/2022-04/queries/cart
https://shopify.dev/api/storefront/2022-04/mutations/cartCreate
Those queries give me the correct response:
Create:
{"data": {"cart": {"id": "gid://shopify/Cart/123456","createdAt": "2022-05-24T12:36:53Z","updatedAt": "2022-05-24T12:36:54Z","lines": {"edges": [{"node": {
Get
{"data": {"id": "gid://shopify/Cart/123456","createdAt": "2022-05-24T12:36:53Z","updatedAt": "202
However, when I try to update cart cookie on my Site to get the cart being updated and call an AJAX request (or just reload the page):
jQuery.getJSON('/cart.json', function(cart) {
console.log(cart)
} );
There will not be a cart response.
And vice-versa. When On the shop site, I add some Variant to the basket, then get this cart id, and try to get the information about the cart via Storefront API; I've got:
"cart": null,"userErrors": [{"field": ["cartId"],"message": "The specified cart does not exist."}]
Can somebody explain why this can happen?
Hi!
I also try to figure it out. Maybe it is not possible. This post here has simmilarities:
Best!