---
title: "ProductVariant"
description: "商品款式，例如大号红色夹克。"
doc_type: graphql
doc_category: storefront
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/objects/product-variant'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/objects/product-variant.md'
---
# ProductVariant

商品款式，例如大号红色夹克。

- **API Version:** v20270301
- **API Type:** Storefront
- **API Protocol:** GraphQL
- **Operation Type:** Object

## Fields

* `image`

  [Image](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common-objects/objects/image.md)

  款式的图片。

* `product`

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

  款式对应商品的唯一标识 ID。

* `inventoryQuantity`

  [Int](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common/scalars/int.md)

  各存放地点的库存数量总和。

* `~~displayName~~`

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

  款式的标题，由款式的规格值拼装而成。 [Deprecated]

* `weight`

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

  款式的重量，超过两位小数向上取整。

* `~~updatedAt~~`

  [Date](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common/scalars/date.md)

  商品款式最近一次更新的时间。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。 [Deprecated]

* `~~inventoryTracker~~`

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

  表明是否开启库存追踪。
  - `true`：开启库存追踪。
  - `false`：不开启库存追踪。 [Deprecated]

* `title`

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

  款式的标题，由款式的规格值拼装而成。

* `~~createdAt~~`

  [Date](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common/scalars/date.md)

  款式的创建时间。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。 [Deprecated]

* `price`

  [Money](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common-objects/objects/money.md)

  款式的售价，数值保留到小数点后两位。

* `selectedOptions`

  [[SelectedOption]](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common-objects/objects/selected-option.md)

  该商品款式当前已选的规格列表。

* `weightUnit`

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

  款式的重量单位。有效枚举值包含：
  - `g`：克
  - `kg`：千克
  - `lb`：磅
  - `oz`：盎司
  - `zh_kg`：公斤

* `sku`

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

  商品 SKU。

* `compareAtPrice`

  [Money](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common-objects/objects/money.md)

  款式的原价，数值保留到小数点后两位。

* `barcode`

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

  款式的条形码。

* `availableForSale`

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

  表明款式是否可售。
  
  - `true`：可售
  - `false`：不可售

* `~~inventoryPolicy~~`

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

  表明款式是否允许超卖。 [Deprecated]

* `taxable`

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

  表明款式是否需要收税。
  
  - `true`：需要收税。
  - `false`：不需要收税。

* `requiresShipping`

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

  表明款式是否需要运输。
  
  - `true`：需要运输。
  - `false`：不需要运输。

* `metafield`

  [Metafield](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common-objects/objects/metafield.md)

  商品款式关联的元字段。

* `metafields`

  [[Metafield]](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common-objects/objects/metafield.md)

  商品款式关联的一组元字段。

* `parentProduct`

  [Product](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/objects/product.md)

  该商品款式对应的商品对象。

* `storeAvailability`

  [StoreAvailabilityConnection](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/objects/store-availability-connection.md)

  商品款式的库存状态信息。

* `requiresSellingPlan`

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

  是否仅允许通过销售计划购买。
  
  - `true`：仅允许通过销售计划购买
  - `false`：允许不通过销售计划购买

* `sellingPlanAllocations`

  [SellingPlanAllocationConnection](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/objects/selling-plan-allocation-connection.md)

  销售计划分配列表。

## Field from

* [ProductVariantEdge](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/objects/product-variant-edge.md).node

* [ProductVariantConnection](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/objects/product-variant-connection.md).nodes

* [CartLine](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/cart/objects/cart-line.md).productVariant

* [Product](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/objects/product.md).selectedOrFirstAvailableVariant

* [Product](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/objects/product.md).variants

* [OrderLineItem](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common-objects/objects/order-line-item.md).variant

* [Query](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/queries/proxy-node-product-variant.md).proxyNodeProductVariant

