Hi,
I was trying to use Storefront API for checkout of products added to cart in Android, as per the documents shared in the link below I was following the steps. The page below has section called 'Creating the Checkout'
In that there is an example of createCheckout. When I am trying to run that query in graphQL, I am getting a reponse as ' {"errors":[{"message":"Field 'checkoutCreate' doesn't exist on type 'Mutation'","locations":[{"line":2,"column":3}],"path":["mutation","checkoutCreate"],"extensions":{"code":"undefinedField","typeName":"Mutation","fieldName":"checkoutCreate"}}]} '
Kindly help me with this.
https://help.shopify.com/en/api/storefront-api/guides/checkout-guide#prerequisites
Hey,
I believe you might be looking at the Storefront API GraphQL ( this is for querying from the store front - you would need a separate access token and endpoint for this )
https://help.shopify.com/en/api/storefront-api/reference/mutation
Edited...
Sorry I misread your post.
It might be perhaps you are querying
the GraphQL Admin API ( this is for querying from the Admin side )
https://help.shopify.com/en/api/graphql-admin-api/reference/mutation
Hello
Same situation goes for me. I tried to query a mutation for a bulk operation to get all products using GraphQL API and yet, I got an error said Field 'bulkOperationRunQuery' doesn't exist on type 'Mutation'. Here is my X-Request-ID (5e514525-1b0f-4e36-80c1-7b9057d8a34c) to let help you check fast. I am not sure if the following syntax were correct because most of the reference is a string for PHP or just string for general programming.
$query =
'mutation {
bulkOperationRunQuery (
query: """
{
productVariants{
edges{
node{
legacyResourceId
sku
product{
onlineStoreUrl
}
}
}
}
}
"""
) {
bulkOperation {
id
status
}
userErrors {
field
message
}
}
}';
$result = $this->request($token, 'POST', $query);
I can confirm that bulkOperationRunQuery does not exist in the schema.
You'll probably have to hope that one of the Shopify staff picks this up.
They may have removed it and just haven't updated their documentation. From what I can tell the GraphQL API library doesn't really do bulk operations. Shopify GraphQL offers a resource cost based calculation so that us API developers don't query for huge amounts of data.
Using cursors you will have to loop through the "products" query to get your products at a slower pace.
Hope that helps.
Cheers,
Gabe
Is that true? If that is so, then it is really a disappointment. And yes, I agreed to be hopeful for the documentation to update, otherwise, it confuses developers like me. But anyway, the good news is that I found another way to use the bulk operation is through the Shopify GraphiQL Explorer installed to our shop and it works. So, I assumed the bulk operation is limited to GraphiQL Explorer for now.
And thanks!
I tested both queries with and without API version and that is very interesting! Both results in work. It used to be originally didn't have any version list in GraphQL documentation until I just look it up now. I could guess perhaps it is not about api version or url. To enlighten us about your situation, could you provide a snippet or some block of codes responsible for sending data to Graphql or API?
This is how I'm using it.
protected function _loadAllProducts($settings) {
$url = 'https://' . $settings['shop'] . '/admin/api/2020-04/graphql.json';
$query =<<<EOF
mutation {
bulkOperationRunQuery(
query: """
{
locations {
edges {
node {
id
name
inventoryLevels{
edges {
node {
id
available
incoming
item {
variant{
id
sku
product {
id
title
}
}
}
}
}
}
}
}
}
}
""")
{
bulkOperation {
id
status
}
userErrors {
field
message
}
}
}
EOF;
if($settings['privateToken'] != null) {
$this->ci->logger->info('priv token ' . $settings['shop']);
$settings['token'] = $settings['privateToken'];
}
$data = json_decode($this->postShopifyData($url, $settings['token'], $query, 'application/graphql'), true);
return $data;
}
User | Count |
---|---|
13 | |
12 | |
7 | |
4 | |
4 |