A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
I am following the official tutorial, migrate your app.
The url I used is https://XXX.myshopify.com/admin/api/2024-04/graphql.json
The script I used in Postman is
---
Solved! Go to the solution
This is an accepted solution.
Hi there
1. cartCreate is a storefront api so your url is not correct . your current url is a admin graphql url. change it to https://XXX.myshopify.com/api/2024-04/graphql.json,
no 'admin' in that url
2. there is indeed no object input type called CartCreateInput. Instead you should use CartInput type. so change it to the CartInput
could refer to the doc. https://shopify.dev/docs/api/storefront/unstable/mutations/cartCreate
This is an accepted solution.
Hi there
1. cartCreate is a storefront api so your url is not correct . your current url is a admin graphql url. change it to https://XXX.myshopify.com/api/2024-04/graphql.json,
no 'admin' in that url
2. there is indeed no object input type called CartCreateInput. Instead you should use CartInput type. so change it to the CartInput
could refer to the doc. https://shopify.dev/docs/api/storefront/unstable/mutations/cartCreate
Hi,
Thank you for replying to my question. I have two further questions I would like to ask. First, what is this migrate your app used for? I am not clear on the difference between admin and storefront.
Additionally, I have already changed the URL to https://XXX.myshopify.com/api/2024-04/graphql.json, which is the body I am using in Postman.
{
"query": "mutation cartCreate($input: CartInput!){ cartCreate(input: $input) { cart { id checkoutUrl lines(first: 5) { edges { node { merchandise { ... on ProductVariant { title } } quantity } } } } } }",
"variables": {
"input": {
"lines": [
{
"quantity": 1,
"merchandiseId": "gid://shopify/ProductVariant/123"
}
]
}
}
}
Did I miss something?
Admin Graphql Api is designed for managing a Shopify store's backend operations. It allows developers to interact with store data, manage products, orders, customers, and other store-related entities. while storefront API is designed for building custom storefronts and customer-facing applications. It allows developers to fetch product data, manage customer sessions, and handle checkout processes.
You could open the website might be your dev store has private passwords. check the store settings.
please ensure that your development store is properly set up and that you are logged into the correct Partners organization and development store. You can also manually create a checkout by adding products to your cart from the storefront and proceeding to checkout.
Hi Han,
I am migrating my shop to new storefront cart api from deprecated checkout api.
Currently, the checkout API allows me to reach the checkout page and complete the checkout process, so I believe my store is already set up and functioning. This is the checkout URL generated using the current checkout API.
https://XXX.myshopify.com/80836493596/checkouts/0d1323cc135fbf013ef1419dd4a402c6?key=12345
However, when I use Postman to get the checkout URL through the storefront cart API, I can not open that url. Do I need to set up anything additional to use the new storefront cart API?