Version: 2025-01
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation DuplicateProduct($productId: ID!, $newTitle: String!, $includeImages: Boolean, $newStatus: ProductStatus) { productDuplicate(productId: $productId, newTitle: $newTitle, includeImages: $includeImages, newStatus: $newStatus) { newProduct { id title vendor productType variants(first: 1) { nodes { id title } } } imageJob { id done } userErrors { field message } } }\",\n \"variables\": {\n \"productId\": \"gid://shopify/Product/20995642\",\n \"newTitle\": \"Copy of Product\",\n \"includeImages\": true,\n \"newStatus\": \"ACTIVE\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation DuplicateProduct($productId: ID!, $newTitle: String!, $includeImages: Boolean, $newStatus: ProductStatus) {\n productDuplicate(productId: $productId, newTitle: $newTitle, includeImages: $includeImages, newStatus: $newStatus) {\n newProduct {\n id\n title\n vendor\n productType\n variants(first: 1) {\n nodes {\n id\n title\n }\n }\n }\n imageJob {\n id\n done\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"productId\": \"gid://shopify/Product/20995642\",\n \"newTitle\": \"Copy of Product\",\n \"includeImages\": true,\n \"newStatus\": \"ACTIVE\"\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation DuplicateProduct($productId: ID!, $newTitle: String!, $includeImages: Boolean, $newStatus: ProductStatus) {\n productDuplicate(productId: $productId, newTitle: $newTitle, includeImages: $includeImages, newStatus: $newStatus) {\n newProduct {\n id\n title\n vendor\n productType\n variants(first: 1) {\n nodes {\n id\n title\n }\n }\n }\n imageJob {\n id\n done\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"productId\": \"gid://shopify/Product/20995642\",\n \"newTitle\": \"Copy of Product\",\n \"includeImages\": true,\n \"newStatus\": \"ACTIVE\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation DuplicateProduct($productId: ID!, $newTitle: String!, $includeImages: Boolean, $newStatus: ProductStatus) {\n productDuplicate(productId: $productId, newTitle: $newTitle, includeImages: $includeImages, newStatus: $newStatus) {\n newProduct {\n id\n title\n vendor\n productType\n variants(first: 1) {\n nodes {\n id\n title\n }\n }\n }\n imageJob {\n id\n done\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"productId\" => \"gid://shopify/Product/20995642\",\n \"newTitle\" => \"Copy of Product\",\n \"includeImages\" => true,\n \"newStatus\" => \"ACTIVE\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation DuplicateProduct($productId: ID!, $newTitle: String!, $includeImages: Boolean, $newStatus: ProductStatus) {\n productDuplicate(productId: $productId, newTitle: $newTitle, includeImages: $includeImages, newStatus: $newStatus) {\n newProduct {\n id\n title\n vendor\n productType\n variants(first: 1) {\n nodes {\n id\n title\n }\n }\n }\n imageJob {\n id\n done\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"productId\": \"gid://shopify/Product/20995642\",\n \"newTitle\": \"Copy of Product\",\n \"includeImages\": true,\n \"newStatus\": \"ACTIVE\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation DuplicateProduct($productId: ID!, $newTitle: String!, $includeImages: Boolean, $newStatus: ProductStatus) {\n productDuplicate(productId: $productId, newTitle: $newTitle, includeImages: $includeImages, newStatus: $newStatus) {\n newProduct {\n id\n title\n vendor\n productType\n variants(first: 1) {\n nodes {\n id\n title\n }\n }\n }\n imageJob {\n id\n done\n }\n userErrors {\n field\n message\n }\n }\n}"
input: { "productId": "gid://shopify/Product/20995642", "newTitle": "Copy of Product", "includeImages": true, "newStatus": "ACTIVE" }
response: { "data": { "productDuplicate": { "newProduct": { "id": "gid://shopify/Product/1072481071", "title": "Copy of Product", "vendor": "Arbor", "productType": "Snowboards", "variants": { "nodes": [ { "id": "gid://shopify/ProductVariant/1070325098", "title": "151cm" } ] } }, "imageJob": null, "userErrors": [] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation DuplicateProduct($productId: ID!, $newTitle: String!, $includeImages: Boolean, $newStatus: ProductStatus, $synchronous: Boolean) { productDuplicate(productId: $productId, newTitle: $newTitle, includeImages: $includeImages, newStatus: $newStatus, synchronous: $synchronous) { productDuplicateOperation { id status newProduct { id title } userErrors { field message } } } }\",\n \"variables\": {\n \"productId\": \"gid://shopify/Product/20995642\",\n \"newTitle\": \"Copy of Product\",\n \"includeImages\": true,\n \"newStatus\": \"ACTIVE\",\n \"synchronous\": false\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation DuplicateProduct($productId: ID!, $newTitle: String!, $includeImages: Boolean, $newStatus: ProductStatus, $synchronous: Boolean) {\n productDuplicate(productId: $productId, newTitle: $newTitle, includeImages: $includeImages, newStatus: $newStatus, synchronous: $synchronous) {\n productDuplicateOperation {\n id\n status\n newProduct {\n id\n title\n }\n userErrors {\n field\n message\n }\n }\n }\n }`,\n \"variables\": {\n \"productId\": \"gid://shopify/Product/20995642\",\n \"newTitle\": \"Copy of Product\",\n \"includeImages\": true,\n \"newStatus\": \"ACTIVE\",\n \"synchronous\": false\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation DuplicateProduct($productId: ID!, $newTitle: String!, $includeImages: Boolean, $newStatus: ProductStatus, $synchronous: Boolean) {\n productDuplicate(productId: $productId, newTitle: $newTitle, includeImages: $includeImages, newStatus: $newStatus, synchronous: $synchronous) {\n productDuplicateOperation {\n id\n status\n newProduct {\n id\n title\n }\n userErrors {\n field\n message\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"productId\": \"gid://shopify/Product/20995642\",\n \"newTitle\": \"Copy of Product\",\n \"includeImages\": true,\n \"newStatus\": \"ACTIVE\",\n \"synchronous\": false\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation DuplicateProduct($productId: ID!, $newTitle: String!, $includeImages: Boolean, $newStatus: ProductStatus, $synchronous: Boolean) {\n productDuplicate(productId: $productId, newTitle: $newTitle, includeImages: $includeImages, newStatus: $newStatus, synchronous: $synchronous) {\n productDuplicateOperation {\n id\n status\n newProduct {\n id\n title\n }\n userErrors {\n field\n message\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"productId\" => \"gid://shopify/Product/20995642\",\n \"newTitle\" => \"Copy of Product\",\n \"includeImages\" => true,\n \"newStatus\" => \"ACTIVE\",\n \"synchronous\" => false,\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation DuplicateProduct($productId: ID!, $newTitle: String!, $includeImages: Boolean, $newStatus: ProductStatus, $synchronous: Boolean) {\n productDuplicate(productId: $productId, newTitle: $newTitle, includeImages: $includeImages, newStatus: $newStatus, synchronous: $synchronous) {\n productDuplicateOperation {\n id\n status\n newProduct {\n id\n title\n }\n userErrors {\n field\n message\n }\n }\n }\n }`,\n {\n variables: {\n \"productId\": \"gid://shopify/Product/20995642\",\n \"newTitle\": \"Copy of Product\",\n \"includeImages\": true,\n \"newStatus\": \"ACTIVE\",\n \"synchronous\": false\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation DuplicateProduct($productId: ID!, $newTitle: String!, $includeImages: Boolean, $newStatus: ProductStatus, $synchronous: Boolean) {\n productDuplicate(productId: $productId, newTitle: $newTitle, includeImages: $includeImages, newStatus: $newStatus, synchronous: $synchronous) {\n productDuplicateOperation {\n id\n status\n newProduct {\n id\n title\n }\n userErrors {\n field\n message\n }\n }\n }\n}"
input: { "productId": "gid://shopify/Product/20995642", "newTitle": "Copy of Product", "includeImages": true, "newStatus": "ACTIVE", "synchronous": false }
response: { "data": { "productDuplicate": { "productDuplicateOperation": { "id": "gid://shopify/ProductDuplicateOperation/1010603707", "status": "CREATED", "newProduct": null, "userErrors": [] } } } }