Hello,
I'm having an issue while I save a product with variants.
This issue only happens when I have products that have like 20 variants or even more, and when I try to add that product using GraphQL, It shows me an error like:
Server error: `POST https://store.myshopify.com/admin/api/2020-04/graphql.json` resulted in a `502 Bad Gateway`
$query = 'mutation productCreate($input: ProductInput!) {
productCreate(input: $input) {
userErrors {
field
message
}
product {
id,
title
}
}
}';
$input = array(
"input" => [
'title' => $title,
'descriptionHtml' => $description,
'vendor' => $vendor,
'published' => true,
'productType' => $productType ,
'metafields' => $metafields,
'tags' => $tags,
'options' => $options ,
'variants' => $variants
]
);
Looking forward to your help!
All the best!
Hi @helidona,
Is this behaviour consistently reproducible (e.g. with less than 20 variants)? Can you provide the X-Request-Id from the response headers?
CalD | Developer Support @ Shopify
- Was my reply helpful? Click Like to let me 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
Hi @CalD,
Here you can find the X-Request-ID:
X-Request-ID: {
0: "859eb10d-312e-4d08-9f98-915cf2ed4e8c"
},
On the other hand, does Shopify allows adding more than 100 variants to a product using GraphQL API?
Thank you for your feedback!
I believe the 100 variants per product is a hard-coded limit, regardless of the API mechanism that's used --> https://community.shopify.com/c/Shopify-Discussion/how-to-remove-100-Variants-limt/td-p/321069.
Hi @Greg_Kujawa,
I got it :), thank you for your response!
However, have you checked that error, when I tried the same request with REST API it shows the same error?
Here is another REQUEST:
[X-Request-ID] => Array
(
[0] => 3ad24d94-f938-40bd-bc54-6f5823de8395
)
Waiting for your positive response!
I can't see the underlying GraphQL request that's actually being sent, since you just provided the source code with its implied variables. But as for the X-Request-ID, if there is a Shopify staffer monitoring the forum then I'm sure they can cross-reference it to see what's happening on their end. Good luck!
User | Count |
---|---|
12 | |
12 | |
10 | |
8 | |
7 |