Products > Product Variants > productVariantsCreate
Commerce APIProductsProduct VariantsproductVariantsCreate
productVariantsCreate
POST:product_variants.json

Description

Create one or multiple variants.

Permission bit: "product_variants.create"

Topic: Product Variants

Arguments

data: [ProductVariantCreate!]!

Main argument for mutations.


product_id: String

Unique product identifier. See also: Unique Identifiers

Example: "pd_EQzGqWoY"


shop_id: String!

Unique shop identifier. See also: Unique Identifiers

Example: "sh_EQzGqWoY"


Data Argument Fields

attachment_id: String

Attachment file ID

Example: "fi_EQzGqWoY"

Valid when: attachment_id matches regexp pattern: ^fi_|^fc_


barcode: String

The barcode, UPC or ISBN number for the product

Example: "1234_pink"

Valid when: barcode's length doesn't exceed 250 characters


bundle_line_items: [BundleLineItemCreate!]

Items in the bundle


cost_price: Int

The cost price of the product variant

Example: 150

Valid when: cost_price is a non-negative integer


country_of_origin: String

Country of origin (ISO 3166-1 alpha-2)

Example: "US"


currency_prices: [VariantCurrencyPrice!]

List of prices specific to currencies


custom_fields: [CustomFieldCreate!]


customer_group_prices: [VariantCustomerGroupPrice!]

List of prices specific to customer groups


discountable: Boolean

Whether discount can be applied to this variant or not

Example: false


expiration_days: Int

Amount of days the product is available for download after purchase (digital product), 0 if not limited

Example: 5


fulfillment_service: FulfillmentService

Service who is doing the fulfillment


grams: Int

The weight of the product variant in grams

Example: 200

Valid when: grams is a non-negative integer


height: Int

Height of the product (in millimeters) used which can be used when calculating shipping costs

Example: 200

Valid when: height is a non-negative integer


hs_code: String

Harmonized System (HS) Code

Example: "6404.19"

Valid when: hs_code's length doesn't exceed 250 characters


inventory_management: InventoryManagement

Specifies whether or not system tracks the number of items in stock for this product variant


inventory_policy: InventoryPolicy

Specifies whether or not customers are allowed to place an order for a product variant when it's out of stock


is_default: Boolean

Whether this variant is a default variant of a product

Example: false


length: Int

Length of the product (in millimeters) used which can be used when calculating shipping costs

Example: 200

Valid when: length is a non-negative integer


map_price: Int

The minimum advertised price of the product variant

Example: 190

Valid when: map_price is a non-negative integer


max_downloads: Int

Maximum number of downloads (digital product), 0 if not limited

Example: 10


media_files: [MediaFileCreate!]

Media files for this variant


options: [VariantOptionCreate!]

List of options


position: Int

The order of the product variant in the list of product variants

Example: 0


price: Int

The price of the product variant

Example: 190

Valid when: price is a non-negative integer


product_id: String

A unique product identifier

Example: "pd_EQzGqWoY"

Valid when: product_id matches regexp pattern: ^pd_


retail_price: Int

The retail cost of the product variant

Example: 190

Valid when: retail_price is a non-negative integer


sale_price: Int

Special price for a product that can be active during a selected period of time

Example: 120

Valid when: sale_price is a non-negative integer


sale_price_from: String

Lower date boundary when sale price is active

Example: "2014-09-04T12:23:34Z"

Timestamp (RFC 3339)


sale_price_to: String

Upper date boundary when sale price is active

Example: "2014-09-04T12:23:34Z"

Timestamp (RFC 3339)


sku: String!

A unique identifier for the product variant in the shop (stock keeping unit)

Example: "IPOD2008PINK"

Valid when: sku is not empty

Valid when: sku's length doesn't exceed 250 characters


suppliers: [VariantSupplierCreate!]

List of suppliers for this variant


tax_class: String

Tax class of this variant

Example: "default"

Valid when: tax_class's length doesn't exceed 250 characters


taxable: Boolean

Specifies whether or not a tax is charged when the product variant is sold

Example: true


tiered_pricing: TieredPricingCreate


type: VariantType

Type of the variant


width: Int

Width of the product (in millimeters) used which can be used when calculating shipping costs

Example: 200

Valid when: width is a non-negative integer


Result

[ProductVariant!]

Preview (typescript)

Loading module