We’re trying to migrate to the new DuplicateProduct mutation but we’re encountering issues. With the old ProductDuplicateAsyncV2 we would immediately get the new product ID so that we can wait for it to be ready and make further changes automatically.
The new DuplicateProduct mutations always returns ‘null’ for newProduct { id }. Will this be addressed?
What’s worse is it also returns the ID of the ProductDuplicateOperation, for example “gid://shopify/ProductDuplicateOperation/2165997744”. So you would expect to be able to retrieve this job, and eventually get the product ID… but that does not work either:
{
node(id: "gid://shopify/ProductDuplicateOperation/2165997744") {
... on ProductDuplicateOperation {
newProduct {
id
}
}
}
}
Results in:
{
"errors": [
{
"message": "Internal error. Looks like something went wrong on our end.\nRequest ID: 62a3933f-6953-4be4-8f3e-8479c274677a-1728402382 (include this in support requests).",
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"requestId": "62a3933f-6953-4be4-8f3e-8479c274677a-1728402382"
}
}
]
}
Please advise! We cannot use this migration in its current state.
It’s also worth noting that we posted this in the old community forum months ago and it’s still broken on all API versions.
Old post: DuplicateProduct mutation retrieve new product ID - Shopify Community
Hi Yavor,
I’ve connected with the products team on this and will let you know what their recommendation is.
Hi Yavor,
Can you post the full mutation you’re using and in what context it’s being used? Also, can you get a fresh requestId
, as the one you posted isn’t appearing for us.
Our product team also had this context to share:
The mutation returns null
product ID
only when run in asynchronous mode.
In this case productDuplicateOperation
is returned. Once operation is completed product ID
can be fetched from the operation.To retrieve product ID
in the same request the mutation need to be run in synchronous mode
Thank you for the response! That’s correct, we’re using the async flow and we understand that it may not return the product ID. The duplication operation however should return it, or return some status, not just fail.
Here’s a new example: “Internal error. Looks like something went wrong on our end.\nRequest ID: 3b844d38-23e2-481b-9fe0-b3d0b6b391d8-1737058042 (include this in support requests).”
Would there be a specific reason why you can’t use synchronous mode for this?
It is used in a flow where the customer is clicking a button to replicate a product. In the past we’ve seen this take quite a while on products with say 100 variants where each variant has a different image. Thus, it would be best if we can respond immediately with success, and allow the duplication to complete later.
In the flow we get a reference to the product ID, which is all we need to allow the shop owner to continue setting things up. We also use an async flow to check when the product is ready and apply the rest of the modifications that were needed.
From a user perspective there is no need to wait for the full replication process, as long as we can keep a reference of the product ID and update it later. A similar solution could be done using the productDuplicateOperation, but it also does not work at this time.
Hi Yavor,
Appreciate you outlining your use case here, have shared this with the product team, and will be valuable for evaluating investment in changing the current bahaviour.
We’re not actually asking for changes to the current behavior, just for a fix to the issue that retrieving a ProductDuplicateOperation object using GraphQL always fails:
{
node(id: "gid://shopify/ProductDuplicateOperation/2165997744") {
... on ProductDuplicateOperation {
newProduct {
id
}
}
}
}
This is expected to work, is it not?
Even if I try this minutes later, long after the duplication was completed, it still returns the same error message as above “Internal error. Looks like something went wrong on our end.”
Hey Yavor,
I don’t think how you’ve structured the query is expected to work, it should be:
query productOperation {
productOperation(id: "gid://shopify/ProductDuplicateOperation/123456789") {
status
product {
id
title
}
... on ProductDuplicateOperation {
id
newProduct {
id
title
}
}
}
which would respond successfully with:
{
"data": {
"productOperation": {
"status": "COMPLETE",
"product": {
"id": "gid://shopify/Product/0987654321",
"title": "test-title"
},
"id": "gid://shopify/ProductDuplicateOperation/123456789",
"newProduct": {
"id": "gid://shopify/Product/0987654321",
"title": "product-title"
}
}
},
"extensions": {
"cost": {
"requestedQueryCost": 3,
"actualQueryCost": 3
}
}
}
and matches the example here: productOperation - GraphQL Admin
1 Like
That was the issue! Thank you so much for the help @Liam-Shopify !
1 Like