GitHub

DaffConfigurableProductVariant

A variant is one version of the configurable product with all attributes chosen. Variants exist because not all versions of every configuration of the product might be in stock. For example, a shirt might have a medium, red shirt and a small, green shirt in stock, but no small, red shirts. In this case there would be two variants (mediumRed, smallGreen) rather than the maximum 4 variants (smallRed, mediumRed, smallGreen, mediumGreen). This ensures the customer can't add a configurable product to the cart that is not in stock. However, variants don't usually need to be considered by the frontend dev, because daffodil abstacts away the concept of variants into an "available attributes" selector.

import { DaffConfigurableProductVariant } from '@daffodil/product-configurable'
interface DaffConfigurableProductVariant {
  appliedAttributes: DaffProductVariantAttributesDictionary
  price: number
  discount: DaffProductDiscount
  image: DaffProductImage
  in_stock: boolean
}

Properties

Name Type Description
appliedAttributes DaffProductVariantAttributesDictionary

The attributes applied to the product to form the product variant.

price number

The price of the variant.

discount DaffProductDiscount

The total discount for the variant.

image DaffProductImage

An image of the product variant.

in_stock boolean

Whether or not the variant is in stock.