Home > widget-integration > ProductModel

ProductModel class

Product Item Model - Data model for product item state

Signature:

export declare class ProductModel 

Constructors

Constructor

Modifiers

Description

(constructor)(data)

Constructs a new instance of the ProductModel class

Properties

Property

Modifiers

Type

Description

handle

readonly

string

images

readonly

ProductImage[]

isOnSale

readonly

boolean

Check if current variant is on sale

isSoldOut

readonly

boolean

Check if current variant is sold out

optionsWithValues

readonly

OptionsWithValues$2[]

productId

readonly

string | number

quantity

number

selectedVariant

ProductItemVariant$3 | null

variants

readonly

ProductItemVariant$3[]

Methods

Method

Modifiers

Description

getVariantImage()

Get image for selected variant

selectVariant(variantId)

Select variant by ID

selectVariantByTitle(title)

Select variant by title (combined option values)