# productCreate - admin-graphql - MUTATION Version: 2025-01 ## Description Creates a [product](https://shopify.dev/docs/api/admin-graphql/latest/objects/Product) with attributes such as title, description, and vendor. You can use the `productCreate` mutation to define [options](https://shopify.dev/docs/api/admin-graphql/latest/objects/ProductOption) and [values](https://shopify.dev/docs/api/admin-graphql/latest/objects/ProductOptionValue) for products with [product variants](https://shopify.dev/docs/api/admin-graphql/latest/objects/ProductVariant), such as different sizes or colors. To create multiple product variants for a single product and manage prices, use the [`productVariantsBulkCreate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/productVariantsBulkCreate) mutation. To create or update a product in a single request, use the [`productSet`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/productSet) mutation. Learn more about the [product model](https://shopify.dev/docs/apps/build/graphql/migrate/new-product-model) and [adding product data](https://shopify.dev/docs/apps/build/graphql/migrate/new-product-model/add-data). ### Access Scopes `write_products` access scope. Also: The user must have a permission to create products. ## Arguments * [input](/docs/api/admin-graphql/2025-01/input-objects/ProductInput): ProductInput - The properties of the new product. * [media](/docs/api/admin-graphql/2025-01/input-objects/CreateMediaInput): CreateMediaInput - The media to add to the product. * [product](/docs/api/admin-graphql/2025-01/input-objects/ProductCreateInput): ProductCreateInput - The attributes of the new product. ## Returns * [product](/docs/api/admin-graphql/2025-01/objects/Product): Product The product object. * [shop](/docs/api/admin-graphql/2025-01/objects/Shop): Shop! The shop associated with the product. * [userErrors](/docs/api/admin-graphql/2025-01/objects/UserError): UserError! The list of errors that occurred from executing the mutation. ## Examples ### Create a product 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 { productCreate(product: {title: \\\"Cool socks\\\", productOptions: [{name: \\\"Color\\\", values: [{name: \\\"Red\\\"}, {name: \\\"Blue\\\"}]}, {name: \\\"Size\\\", values: [{name: \\\"Small\\\"}, {name: \\\"Large\\\"}]}]}) { product { id title options { id name position optionValues { id name hasVariants } } } userErrors { field message } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `mutation {\n productCreate(product: {title: \"Cool socks\", productOptions: [{name: \"Color\", values: [{name: \"Red\"}, {name: \"Blue\"}]}, {name: \"Size\", values: [{name: \"Small\"}, {name: \"Large\"}]}]}) {\n product {\n id\n title\n options {\n id\n name\n position\n optionValues {\n id\n name\n hasVariants\n }\n }\n }\n userErrors {\n field\n message\n }\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 {\n productCreate(product: {title: \"Cool socks\", productOptions: [{name: \"Color\", values: [{name: \"Red\"}, {name: \"Blue\"}]}, {name: \"Size\", values: [{name: \"Small\"}, {name: \"Large\"}]}]}) {\n product {\n id\n title\n options {\n id\n name\n position\n optionValues {\n id\n name\n hasVariants\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation {\n productCreate(product: {title: \"Cool socks\", productOptions: [{name: \"Color\", values: [{name: \"Red\"}, {name: \"Blue\"}]}, {name: \"Size\", values: [{name: \"Small\"}, {name: \"Large\"}]}]}) {\n product {\n id\n title\n options {\n id\n name\n position\n optionValues {\n id\n name\n hasVariants\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "mutation {\n productCreate(product: {title: \"Cool socks\", productOptions: [{name: \"Color\", values: [{name: \"Red\"}, {name: \"Blue\"}]}, {name: \"Size\", values: [{name: \"Small\"}, {name: \"Large\"}]}]}) {\n product {\n id\n title\n options {\n id\n name\n position\n optionValues {\n id\n name\n hasVariants\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "productCreate": { "product": { "id": "gid://shopify/Product/1072481267", "title": "Cool socks", "options": [ { "id": "gid://shopify/ProductOption/1064576771", "name": "Color", "position": 1, "optionValues": [ { "id": "gid://shopify/ProductOptionValue/1054672637", "name": "Red", "hasVariants": true }, { "id": "gid://shopify/ProductOptionValue/1054672638", "name": "Blue", "hasVariants": false } ] }, { "id": "gid://shopify/ProductOption/1064576772", "name": "Size", "position": 2, "optionValues": [ { "id": "gid://shopify/ProductOptionValue/1054672639", "name": "Small", "hasVariants": true }, { "id": "gid://shopify/ProductOptionValue/1054672640", "name": "Large", "hasVariants": false } ] } ] }, "userErrors": [] } } } ### Create a product and associate metafields 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 { productCreate(product: {title: \\\"Hiking Boots\\\", metafields: [{namespace: \\\"my_fields\\\", key: \\\"liner_material\\\", type: \\\"single_line_text_field\\\", value: \\\"Synthetic Leather\\\"}]}) { product { id title metafields(first: 1) { nodes { id namespace key value } } } userErrors { field message } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `mutation {\n productCreate(product: {title: \"Hiking Boots\", metafields: [{namespace: \"my_fields\", key: \"liner_material\", type: \"single_line_text_field\", value: \"Synthetic Leather\"}]}) {\n product {\n id\n title\n metafields(first: 1) {\n nodes {\n id\n namespace\n key\n value\n }\n }\n }\n userErrors {\n field\n message\n }\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 {\n productCreate(product: {title: \"Hiking Boots\", metafields: [{namespace: \"my_fields\", key: \"liner_material\", type: \"single_line_text_field\", value: \"Synthetic Leather\"}]}) {\n product {\n id\n title\n metafields(first: 1) {\n nodes {\n id\n namespace\n key\n value\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation {\n productCreate(product: {title: \"Hiking Boots\", metafields: [{namespace: \"my_fields\", key: \"liner_material\", type: \"single_line_text_field\", value: \"Synthetic Leather\"}]}) {\n product {\n id\n title\n metafields(first: 1) {\n nodes {\n id\n namespace\n key\n value\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "mutation {\n productCreate(product: {title: \"Hiking Boots\", metafields: [{namespace: \"my_fields\", key: \"liner_material\", type: \"single_line_text_field\", value: \"Synthetic Leather\"}]}) {\n product {\n id\n title\n metafields(first: 1) {\n nodes {\n id\n namespace\n key\n value\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "productCreate": { "product": { "id": "gid://shopify/Product/1072481265", "title": "Hiking Boots", "metafields": { "nodes": [ { "id": "gid://shopify/Metafield/1069229368", "namespace": "my_fields", "key": "liner_material", "value": "Synthetic Leather" } ] } }, "userErrors": [] } } } ### Create a product and return the product ID 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 { productCreate(product: {title: \\\"Sweet new product\\\", productType: \\\"Snowboard\\\", vendor: \\\"JadedPixel\\\"}) { product { id } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `mutation {\n productCreate(product: {title: \"Sweet new product\", productType: \"Snowboard\", vendor: \"JadedPixel\"}) {\n product {\n id\n }\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 {\n productCreate(product: {title: \"Sweet new product\", productType: \"Snowboard\", vendor: \"JadedPixel\"}) {\n product {\n id\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation {\n productCreate(product: {title: \"Sweet new product\", productType: \"Snowboard\", vendor: \"JadedPixel\"}) {\n product {\n id\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "mutation {\n productCreate(product: {title: \"Sweet new product\", productType: \"Snowboard\", vendor: \"JadedPixel\"}) {\n product {\n id\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "productCreate": { "product": { "id": "gid://shopify/Product/1072481266" } } } } ### Create a product with a combined listing role 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 { productCreate(product: {title: \\\"Helmet Nova\\\", combinedListingRole: PARENT}) { product { id combinedListingRole } userErrors { field message } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `mutation {\n productCreate(product: {title: \"Helmet Nova\", combinedListingRole: PARENT}) {\n product {\n id\n combinedListingRole\n }\n userErrors {\n field\n message\n }\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 {\n productCreate(product: {title: \"Helmet Nova\", combinedListingRole: PARENT}) {\n product {\n id\n combinedListingRole\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation {\n productCreate(product: {title: \"Helmet Nova\", combinedListingRole: PARENT}) {\n product {\n id\n combinedListingRole\n }\n userErrors {\n field\n message\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "mutation {\n productCreate(product: {title: \"Helmet Nova\", combinedListingRole: PARENT}) {\n product {\n id\n combinedListingRole\n }\n userErrors {\n field\n message\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "productCreate": { "product": { "id": "gid://shopify/Product/1072481268", "combinedListingRole": "PARENT" }, "userErrors": [] } } } ### Create a product with media 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 CreateProductWithNewMedia($product: ProductCreateInput!, $media: [CreateMediaInput!]) { productCreate(product: $product, media: $media) { product { id title media(first: 10) { nodes { alt mediaContentType preview { status } } } } userErrors { field message } } }\",\n \"variables\": {\n \"product\": {\n \"title\": \"Helmet Nova\"\n },\n \"media\": [\n {\n \"originalSource\": \"https://cdn.shopify.com/shopifycloud/brochure/assets/sell/image/image-@artdirection-large-1ba8d5de56c361cec6bc487b747c8774b9ec8203f392a99f53c028df8d0fb3fc.png\",\n \"alt\": \"Gray helmet for bikers\",\n \"mediaContentType\": \"IMAGE\"\n },\n {\n \"originalSource\": \"https://www.youtube.com/watch?v=4L8VbGRibj8&list=PLlMkWQ65HlcEoPyG9QayqEaAu0ftj0MMz\",\n \"alt\": \"Testing helmet resistance against impacts\",\n \"mediaContentType\": \"EXTERNAL_VIDEO\"\n }\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation CreateProductWithNewMedia($product: ProductCreateInput!, $media: [CreateMediaInput!]) {\n productCreate(product: $product, media: $media) {\n product {\n id\n title\n media(first: 10) {\n nodes {\n alt\n mediaContentType\n preview {\n status\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"product\": {\n \"title\": \"Helmet Nova\"\n },\n \"media\": [\n {\n \"originalSource\": \"https://cdn.shopify.com/shopifycloud/brochure/assets/sell/image/image-@artdirection-large-1ba8d5de56c361cec6bc487b747c8774b9ec8203f392a99f53c028df8d0fb3fc.png\",\n \"alt\": \"Gray helmet for bikers\",\n \"mediaContentType\": \"IMAGE\"\n },\n {\n \"originalSource\": \"https://www.youtube.com/watch?v=4L8VbGRibj8&list=PLlMkWQ65HlcEoPyG9QayqEaAu0ftj0MMz\",\n \"alt\": \"Testing helmet resistance against impacts\",\n \"mediaContentType\": \"EXTERNAL_VIDEO\"\n }\n ]\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 CreateProductWithNewMedia($product: ProductCreateInput!, $media: [CreateMediaInput!]) {\n productCreate(product: $product, media: $media) {\n product {\n id\n title\n media(first: 10) {\n nodes {\n alt\n mediaContentType\n preview {\n status\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"product\": {\n \"title\": \"Helmet Nova\"\n },\n \"media\": [{\"originalSource\"=>\"https://cdn.shopify.com/shopifycloud/brochure/assets/sell/image/image-@artdirection-large-1ba8d5de56c361cec6bc487b747c8774b9ec8203f392a99f53c028df8d0fb3fc.png\", \"alt\"=>\"Gray helmet for bikers\", \"mediaContentType\"=>\"IMAGE\"}, {\"originalSource\"=>\"https://www.youtube.com/watch?v=4L8VbGRibj8&list=PLlMkWQ65HlcEoPyG9QayqEaAu0ftj0MMz\", \"alt\"=>\"Testing helmet resistance against impacts\", \"mediaContentType\"=>\"EXTERNAL_VIDEO\"}]\n}\n\nresponse = 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 CreateProductWithNewMedia($product: ProductCreateInput!, $media: [CreateMediaInput!]) {\n productCreate(product: $product, media: $media) {\n product {\n id\n title\n media(first: 10) {\n nodes {\n alt\n mediaContentType\n preview {\n status\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"product\": {\n \"title\": \"Helmet Nova\"\n },\n \"media\": [\n {\n \"originalSource\": \"https://cdn.shopify.com/shopifycloud/brochure/assets/sell/image/image-@artdirection-large-1ba8d5de56c361cec6bc487b747c8774b9ec8203f392a99f53c028df8d0fb3fc.png\",\n \"alt\": \"Gray helmet for bikers\",\n \"mediaContentType\": \"IMAGE\"\n },\n {\n \"originalSource\": \"https://www.youtube.com/watch?v=4L8VbGRibj8&list=PLlMkWQ65HlcEoPyG9QayqEaAu0ftj0MMz\",\n \"alt\": \"Testing helmet resistance against impacts\",\n \"mediaContentType\": \"EXTERNAL_VIDEO\"\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation CreateProductWithNewMedia($product: ProductCreateInput!, $media: [CreateMediaInput!]) {\n productCreate(product: $product, media: $media) {\n product {\n id\n title\n media(first: 10) {\n nodes {\n alt\n mediaContentType\n preview {\n status\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n}" #### Graphql Input { "product": { "title": "Helmet Nova" }, "media": [ { "originalSource": "https://cdn.shopify.com/shopifycloud/brochure/assets/sell/image/image-@artdirection-large-1ba8d5de56c361cec6bc487b747c8774b9ec8203f392a99f53c028df8d0fb3fc.png", "alt": "Gray helmet for bikers", "mediaContentType": "IMAGE" }, { "originalSource": "https://www.youtube.com/watch?v=4L8VbGRibj8&list=PLlMkWQ65HlcEoPyG9QayqEaAu0ftj0MMz", "alt": "Testing helmet resistance against impacts", "mediaContentType": "EXTERNAL_VIDEO" } ] } #### Graphql Response { "data": { "productCreate": { "product": { "id": "gid://shopify/Product/1072481264", "title": "Helmet Nova", "media": { "nodes": [ { "alt": "Gray helmet for bikers", "mediaContentType": "IMAGE", "preview": { "status": "UPLOADED" } }, { "alt": "Testing helmet resistance against impacts", "mediaContentType": "EXTERNAL_VIDEO", "preview": { "status": "UPLOADED" } } ] } }, "userErrors": [] } } } ### Create a product with product options and option values 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 { productCreate(product: {title: \\\"New product\\\", productOptions: [{name: \\\"Color\\\", values: [{name: \\\"Red\\\"}, {name: \\\"Green\\\"}]}, {name: \\\"Size\\\", values: [{name: \\\"Small\\\"}, {name: \\\"Medium\\\"}]}]}) { userErrors { field message } product { id options { id name position values optionValues { id name hasVariants } } variants(first: 5) { nodes { id title selectedOptions { name value } } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `mutation {\n productCreate(product: {title: \"New product\", productOptions: [{name: \"Color\", values: [{name: \"Red\"}, {name: \"Green\"}]}, {name: \"Size\", values: [{name: \"Small\"}, {name: \"Medium\"}]}]}) {\n userErrors {\n field\n message\n }\n product {\n id\n options {\n id\n name\n position\n values\n optionValues {\n id\n name\n hasVariants\n }\n }\n variants(first: 5) {\n nodes {\n id\n title\n selectedOptions {\n name\n value\n }\n }\n }\n }\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 {\n productCreate(product: {title: \"New product\", productOptions: [{name: \"Color\", values: [{name: \"Red\"}, {name: \"Green\"}]}, {name: \"Size\", values: [{name: \"Small\"}, {name: \"Medium\"}]}]}) {\n userErrors {\n field\n message\n }\n product {\n id\n options {\n id\n name\n position\n values\n optionValues {\n id\n name\n hasVariants\n }\n }\n variants(first: 5) {\n nodes {\n id\n title\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation {\n productCreate(product: {title: \"New product\", productOptions: [{name: \"Color\", values: [{name: \"Red\"}, {name: \"Green\"}]}, {name: \"Size\", values: [{name: \"Small\"}, {name: \"Medium\"}]}]}) {\n userErrors {\n field\n message\n }\n product {\n id\n options {\n id\n name\n position\n values\n optionValues {\n id\n name\n hasVariants\n }\n }\n variants(first: 5) {\n nodes {\n id\n title\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "mutation {\n productCreate(product: {title: \"New product\", productOptions: [{name: \"Color\", values: [{name: \"Red\"}, {name: \"Green\"}]}, {name: \"Size\", values: [{name: \"Small\"}, {name: \"Medium\"}]}]}) {\n userErrors {\n field\n message\n }\n product {\n id\n options {\n id\n name\n position\n values\n optionValues {\n id\n name\n hasVariants\n }\n }\n variants(first: 5) {\n nodes {\n id\n title\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "productCreate": { "userErrors": [], "product": { "id": "gid://shopify/Product/1072481270", "options": [ { "id": "gid://shopify/ProductOption/1064576775", "name": "Color", "position": 1, "values": [ "Red" ], "optionValues": [ { "name": "Red", "hasVariants": true }, { "name": "Green", "hasVariants": false } ] }, { "id": "gid://shopify/ProductOption/1064576776", "name": "Size", "position": 2, "values": [ "Small" ], "optionValues": [ { "name": "Small", "hasVariants": true }, { "name": "Medium", "hasVariants": false } ] } ], "variants": { "nodes": [ { "id": "gid://shopify/ProductVariant/1070325274", "title": "Red / Small", "selectedOptions": [ { "name": "Color", "value": "Red" }, { "name": "Size", "value": "Small" } ] } ] } } } } }