A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
When I query the cart by cart Id, it always returns null. How can I check the payment? Can we retrieve the order from the cart's checkout URL?
query checkoutURL { cart(id: "CART_ID_HERE") { checkoutUrl } }
this returns null:
{ "data": { "cart": null } }
Solved! Go to the solution
This is an accepted solution.
Hey @brodwen , Shopify automatically deletes the cart when the customer completes their checkout, so that would explain the response you are getting.
Once checkout is complete the order is created so from there you can query the customer.orders connection in the storefront API to get the details of the order, or the order endpoint in the admin API.
Hope that helps clarify the reason for receiving the Null response.
- Kyle G.
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
This is an accepted solution.
Hey @brodwen , Shopify automatically deletes the cart when the customer completes their checkout, so that would explain the response you are getting.
Once checkout is complete the order is created so from there you can query the customer.orders connection in the storefront API to get the details of the order, or the order endpoint in the admin API.
Hope that helps clarify the reason for receiving the Null response.
- Kyle G.
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog