We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

migration from Checkout API to Cart API

migration from Checkout API to Cart API

adelchemi
Shopify Partner
4 0 0

Hi,

I'm trying to retrieve checkout or cart using `checkout ui extension + appProxy + backend`

using REST API is very clear and straight forward, we can use the checkout token and retrieve it. but it's already deprecated and should move to GraphQL API and forced to use the Cart API.

Cart API needs the Cart ID. I can't find the cartID anywhere on both checkout frontend react hooks or backend API!!

How can achieve such that?

Reach me on Whatsapp: +213555008657
Replies 2 (2)
adelchemi
Shopify Partner
4 0 0

There's no useCart in checkout-ui-extensions hooks, it exists on store-front API which a different.

here's all hooks available:
https://shopify.dev/docs/api/checkout-ui-extensions/2023-07/react-hooks

for the cartLines

https://shopify.dev/docs/api/checkout-ui-extensions/2023-07/react-hooks/cart/usecartlines

it doesn't even give a stable ids.

Reach me on Whatsapp: +213555008657
adelchemi
Shopify Partner
4 0 0

getting cartLines from the frontend and send it to the backend is not safe at all.

Reach me on Whatsapp: +213555008657