---
title: "ProductVariantsBulkInput"
description: "用于在批量变更中指定要创建的产品变体的输入字段"
doc_type: graphql
doc_category: adminGraphQL
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/products-and-collections/inputs/product-variants-bulk-input'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/products-and-collections/inputs/product-variants-bulk-input.md'
---
# ProductVariantsBulkInput

用于在批量变更中指定要创建的产品变体的输入字段

- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** GraphQL
- **Operation Type:** Input

## Type Signature

`ProductVariantsBulkInput`

## Input Fields

* `inventoryItem`

  [InventoryItemInput](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/inventory/inputs/inventory-item-input.md)

  与变体关联的库存项目。用于单位成本。

* `mediaId`

  [ID](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/id.md)

  与变体关联的媒体 ID，专门用于媒体图像创建突变。如果产品中不存在该媒体ID，则会自动同步到产品媒体中

* `price`

  [Money](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/money.md)

  产品变体的价格，使用商店的默认货币

* `requiresShipping`

  [Boolean](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/boolean.md)

  该变体是否需要运输

* `weight`

  [Float](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/float.md)

  产品变体的重量（以weight_unit 定义的单位表示）

* `compareAtPrice`

  [Money](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/money.md)

  变体的原始价格,使用商店的默认货币单位

* `mediaSrc`

  [[String!]](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/string.md)

  与产品变体相关联的媒体的URL，这个字段仅用于媒体图像创建, 它将自动链接并与产品媒体同步

* `options`

  [[String!]](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/string.md)

  店主用来定义产品变体的自定义属性

* `inventoryPolicy`

  [ProductVariantInventoryPolicy](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/inventory/enums/product-variant-inventory-policy.md)

  当产品变体缺货时是否允许客户下订单。

* `barcode`

  [String](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/string.md)

  与产品变体关联的条形码的值

* `harmonizedSystemCode`

  [String](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/string.md)

  产品变体的海关协调编码（HS编码）或关税编码

* `inventoryQuantities`

  [[InventoryLevelInput!]](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/inventory/inputs/inventory-level-input.md)

  存储变体的每个位置的库存数量。仅支持作为`productVariantCreate` 突变的输入

* `taxable`

  [Boolean](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/boolean.md)

  该变体在出售时是否需征税

* `id`

  [ID](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/id.md)

  指定要更新或删除的产品变体。

* `sku`

  [String](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/string.md)

  变体的 SKU 码，区分大小写的字符串

* `weightUnit`

  [WeightUnit](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common-objects/enums/weight-unit.md)

  变体重量的测量单位。如果未指定 `weight_unit`，则将使用商店的默认测量单位

## Schema Definition

```graphql
input ProductVariantsBulkInput { 
	inventoryItem: InventoryItemInput
	mediaId: ID
	price: Money
	requiresShipping: Boolean
	weight: Float
	compareAtPrice: Money
	mediaSrc: [String!]
	options: [String!]
	inventoryPolicy: ProductVariantInventoryPolicy
	barcode: String
	harmonizedSystemCode: String
	inventoryQuantities: [InventoryLevelInput!]
	taxable: Boolean
	id: ID
	sku: String
	weightUnit: WeightUnit 
}
```

## Argument from

* [Mutation](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/products-and-collections/mutations/product-variants-bulk-create.md).productVariantsBulkCreate

  批量创建产品变体

* [Mutation](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/products-and-collections/mutations/product-variants-bulk-update.md).productVariantsBulkUpdate

  批量更新产品变体。

## Error Handling

关于更多通用错误码说明，参考：[状态码和错误码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md#status-and-error-codes)。

