Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

bulkOperationRunMutation issue with sku and price import

bulkOperationRunMutation issue with sku and price import

vinodk
Shopify Partner
24 0 5

Hello
I am working with app and in the app we are importing bulk product with SKU & price for product with graphql API.
We are using below format for jsonl format but facing these issue.

Invalid Bulk Mutation Field - Field 'sku' doesn't exist on type 'Product'

I am  using below json format.

 

{"input":{"title":"Digestive Enzymes, 1 serv. sz","handle":"digestive-enzymes","descriptionHtml":"Supports healthy digestion. Supports a healthy gut and relieves discomfort.","productType":"","images":[{"altText":"imagename","src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0693\/3390\/9824\/products\/dummy-product_7cd43223-3d0d-4075-b535-2a335cc3c959.png?v=1673955720"}],"variants":[{"sku":"UDIRYF","price":"150"}]}} 

 

Please let me know where i am doing wrong.
Below is query for  bulkOperationRunMutation run

 

mutation {
    bulkOperationRunMutation(
    mutation: "mutation call($input: ProductInput!) { productCreate(input: $input) { product {title handle descriptionHtml productType vendor sku} userErrors { message field } } }",
    stagedUploadPath: "file path") {
    bulkOperation {
      id
      url
      status
    }
    userErrors {
      message
      field
    }
  }
}

 

 

Reply 1 (1)

ShopifyDevSup
Shopify Staff
1453 238 524

Hi @vinodk 👋

 

The SKU field is on the variant level, so you'll need to modify your mutation to query the variant sku rather than the product sku as follows:
 

"mutation ($input: ProductInput!) { productCreate(input: $input) { product { variants (first:10) { nodes { sku ... } } ..."

 

Hope that helps!

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us 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