FROM CACHE - en_header

Can bulkOperationRunQuery operation be used for creating multiple products in one request?

GeorgianaCG
New Member
2 0 0

Hello, 

I came across this documentation (https://shopify.dev/tutorials/perform-bulk-operations-with-admin-api#bulk-query-workflow) , because some of my operations with GraphQL exceed the 1000 cost per request.

Is it possible to use "bulkOperationRunQuery" for putting together a mutation to create multiple products at once and not exceeding the max cost?

This is how the current mutation looks like:

 

mutation ($media: [CreateMediaInput!], $input1: ProductInput!, $input2: ProductInput!) {
  Product1: productCreate(input: $input1, media: $media) {
    product {
      id
      handle
      status
      metafields(first: 1) {
        edges {
          node {
            key
            value
          }
        }
      }
      variants(first: 12) {
        edges {
          node {
            sku
            id
            selectedOptions {
              name
              value
            }
            displayName
            inventoryItem {
              id
            }
          }
        }
      }
      mediaCount
    }
    userErrors {
      field
      message
    }
  }
  Product2: productCreate(input: $input2, media: $media) {
    product {
      id
      createdAt
      metafields(first: 1) {
        edges {
          node {
            key
            value
          }
        }
      }
      variants(first: 12) {
        edges {
          node {
            sku
            selectedOptions {
              name
              value
            }
            id
            inventoryItem {
              id
            }
          }
        }
      }
      mediaCount
    }
    userErrors {
      field
      message
    }
  }
}

 

Any info would be appreciated. Thanks!

Replies 0 (0)