Using Shopify Storefront API for checkout, but there is no built-in cart object available through that API. The current workaround uses an external database/API to store cart items, but this creates a problem: items are being removed when the user clicks Checkout, instead of only after a successful order.
Key points raised:
A direct /cart/... endpoint was tried, but it did not work for this use case.
Storefront API supports creating and mutating a checkout, but not a separate cart.
One suggested workaround is to build a custom cart UI and manage cart state inside the app.
For low to medium traffic, the checkout object could be used like a cart, though this may be less performant for more complex cart behavior.
Current follow-up:
The remaining open issue is how to know whether checkout was completed so the cart can be cleared only after purchase.
A suggested next step is to poll for checkout completion, then clear/update the external cart accordingly.
Status: unresolved; cart persistence and post-purchase cleanup still need implementation.
Am using Shopify Store front API to do the checkout , and ordering the products but couldn’t able to find the API to create cart and follow the further process,
now am using external API to get the products which ever added to the cart and doing checkout process,but here am facing a problem i.e deleting the products once the user click on Checkout button instead of once they done with ordering them.
Can anybody help me in this to either create cart using API or any suggestions to delete the products once after the order is done.
The Storefront API does not contain a cart object. Please build a cart UI in your app and create a checkout when the user is ready to checkout. Alternatively, if you are expecting low - mid traffic you can utilize the checkout object as a cart as it is able to be mutated - but this will be less performant for complex ‘cart’
Thanks for the response,but is there way to create and manage cart in private app?
Currently am using external database services to create and update them but couldn’t get the track after it goes checkout web-view in private application.
If the products are purchased ,I need to remove them from the cart also update cart and
if the products aren’t purchased then they should not delete from the cart and user must be able to see them when he revisit the shopping cart.