Product

Product

Product

A Product contains one or more ProductVariants and serves as a container for those variants, providing an overall name, description etc.

Signature

class Product extends VendureEntity implements Translatable, HasCustomFields, ChannelAware, SoftDeletable {
  constructor(input?: DeepPartial<Product>)
  @Column({ type: Date, nullable: true })
    deletedAt: Date | null;
  name: LocaleString;
  slug: LocaleString;
  description: LocaleString;
  @Column({ default: true })
    enabled: boolean;
  @ManyToOne(type => Asset, { onDelete: 'SET NULL' })
    featuredAsset: Asset;
  @OneToMany(
        type => ProductAsset,
        productAsset => productAsset.product,
        { onDelete: 'SET NULL' },
    )
    assets: ProductAsset[];
  @OneToMany(
        type => ProductTranslation,
        translation => translation.base,
        { eager: true },
    )
    translations: Array<Translation<Product>>;
  @OneToMany(
        type => ProductVariant,
        variant => variant.product,
    )
    variants: ProductVariant[];
  @OneToMany(
        type => ProductOptionGroup,
        optionGroup => optionGroup.product,
    )
    optionGroups: ProductOptionGroup[];
  @ManyToMany(type => FacetValue)
    @JoinTable()
    facetValues: FacetValue[];
  @Column(type => CustomProductFields)
    customFields: CustomProductFields;
  @ManyToMany(type => Channel)
    @JoinTable()
    channels: Channel[];
}

Extends

Implements

  • Translatable
  • HasCustomFields
  • ChannelAware
  • SoftDeletable

Members

constructor

method
type:
(input?: DeepPartial<Product>) => Product

deletedAt

property
type:
Date | null

name

property
type:
LocaleString

slug

property
type:
LocaleString

description

property
type:
LocaleString

enabled

property
type:
boolean

featuredAsset

property
type:
Asset

assets

property
type:
ProductAsset[]

translations

property
type:
Array<Translation<Product>>

variants

property
type:
ProductVariant[]

optionGroups

property

facetValues

property
type:
FacetValue[]

customFields

property
type:
CustomProductFields

channels

property
type:
Channel[]