Admin Api

Topic summary

A developer is attempting to create products using the bulkOperationRunMutation with productCreate, but encounters an issue where the mutation creates a new product instead of updating an existing one, despite passing a product ID in the ProductInput.

Key Details:

  • The mutation includes a stagedUploadPath and references the Shopify Admin API documentation, which states that the id field in ProductInput should update an existing product if present or create a new one if absent.
  • The input includes comprehensive product data: variants with SKU, price, inventory quantities, location IDs, media attachments, collections, tags, product category taxonomy, and vendor information.

Proposed Solution:
Another user suggests using the productUpdate mutation specifically designed for updating existing products.

Status: The issue remains unresolved; the original poster has not confirmed whether switching to productUpdate resolves the problem.

Summarized with AI on November 13. AI used: claude-sonnet-4-5-20250929.

This is my mutation for creating Product

mutation {
        bulkOperationRunMutation(
        mutation: "mutation call($input: ProductInput!, $media: [CreateMediaInput!]) { productCreate(input: $input, media: $media) { product {title productType vendor media(first: 10) {nodes{alt mediaContentType preview {status}}}}
        userErrors { message field } } }",
        stagedUploadPath: "${parsedResult.PostResponse.Key[0]}") {
        bulkOperation {
          id
          url
          status
        }
        userErrors {
          message
          field
        }
      }

API documentation says this

Anchor to ProductInput.id

id
ID

Specifies the product to update in productUpdate or create a new product if absent in productCreate.

This is my sample product

{“input”:{“bodyHtml”:“product description”,“title”:“Car”,“productType”:“provident”,“vendor”:“Johns Group”,“descriptionHtml”:“0001”,“id”:“gid://shopify/Product/1072481716”,“collectionsToJoin”:[“gid://shopify/Collection/296548434079”],“tags”:[“Electronics”,“Cables”],“productCategory”:{“productTaxonomyNodeId”:“gid://shopify/ProductTaxonomyNode/1267”},“variants”:[{“barcode”:“001”,“id”:“gid://shopify/ProductVariant/10079785100”,“price”:“100.00”,“compareAtPrice”:“110.00”,“sku”:“001”,“inventoryItem”:{“cost”:“89.99”,“tracked”:true},“inventoryQuantities”:[{“availableQuantity”:10, “locationId”:“gid://shopify/Location/69241897119”}],“title”:“001”,“weight”:10.0}]},“media”:[{“alt”:“image”,“mediaContentType”:“IMAGE”,“originalSource”:“https://www.gstatic.com/webp/gallery/1.jpg”}]}

But this is not updating the existing product. It creates another product. How to solve this?
thank you.

Can you use the productUpdate mutation to update the product?