productVariantsBulkCreate mutation

Version unstable

Creates product variants in bulk.

Required access

write_products access scope.

Interactive example

This is an example mutation query. Use the embedded interactive tool below to edit the query.

Hint: use Ctrl + Space for autocompleting fields.


Argument Description
productId ( ID! ) required

The ID of the product on which to create the variants.

variants ( [ProductVariantsBulkInput!]! ) required

An array of product variants to be created.

ProductVariantsBulkInput fields

  • barcode (String)

    The value of the barcode associated with the product variant.

  • compareAtPrice (Money)

    The compare-at price of the variant.

  • fulfillmentServiceId (ID)

    The ID of the fulfillment service associated with the variant.

  • harmonizedSystemCode (String)

    The Harmonized System Code (or HS Tariff Code) for the variant.

  • id (ID)

    Specifies the product variant to update or delete.

  • imageId (ID)

    The ID of the image that's associated with the variant.

  • imageSrc (String)

    The URL of an image to associate with the variant. This field can only be used through mutations that create product images and must match one of the URLs being created on the product.

  • inventoryItem (InventoryItemInput)

    The inventory item associated with the variant, used for unit cost.

  • inventoryPolicy (ProductVariantInventoryPolicy)

    Whether customers are allowed to place an order for the variant when it's out of stock.

  • inventoryQuantities ([InventoryLevelInput!])

    Create only field. The inventory quantities at each location where the variant is stocked. The number of elements in the array of inventory quantities cannot exceed 10 and the amount specified for the plan.

  • mediaSrc ([String!])

    The URL of the media to associate with the variant.

  • metafields ([MetafieldInput!])

    The additional customizable information about the product variant.