diff --git a/packages/core/src/config/custom-field/custom-field-types.ts b/packages/core/src/config/custom-field/custom-field-types.ts index 0f52100df8..08c01fe338 100644 --- a/packages/core/src/config/custom-field/custom-field-types.ts +++ b/packages/core/src/config/custom-field/custom-field-types.ts @@ -165,6 +165,7 @@ export type CustomFields = { ProductOption?: CustomFieldConfig[]; ProductOptionGroup?: CustomFieldConfig[]; ProductVariant?: CustomFieldConfig[]; + ProductVariantPrice?: CustomFieldConfig[]; Promotion?: CustomFieldConfig[]; Region?: CustomFieldConfig[]; Seller?: CustomFieldConfig[]; diff --git a/packages/core/src/config/default-config.ts b/packages/core/src/config/default-config.ts index 30bf22c075..49a7b08225 100644 --- a/packages/core/src/config/default-config.ts +++ b/packages/core/src/config/default-config.ts @@ -198,6 +198,7 @@ export const defaultConfig: RuntimeVendureConfig = { ProductOption: [], ProductOptionGroup: [], ProductVariant: [], + ProductVariantPrice: [], Promotion: [], Region: [], Seller: [], diff --git a/packages/core/src/entity/custom-entity-fields.ts b/packages/core/src/entity/custom-entity-fields.ts index 15bebf6e91..298368199e 100644 --- a/packages/core/src/entity/custom-entity-fields.ts +++ b/packages/core/src/entity/custom-entity-fields.ts @@ -24,6 +24,7 @@ export class CustomProductOptionGroupFields {} export class CustomProductOptionGroupFieldsTranslation {} export class CustomProductVariantFields {} export class CustomProductVariantFieldsTranslation {} +export class CustomProductVariantPriceFields {} export class CustomPromotionFields {} export class CustomPromotionFieldsTranslation {} export class CustomRegionFields {} diff --git a/packages/core/src/entity/product-variant/product-variant-price.entity.ts b/packages/core/src/entity/product-variant/product-variant-price.entity.ts index bef6bc19c4..599585267b 100644 --- a/packages/core/src/entity/product-variant/product-variant-price.entity.ts +++ b/packages/core/src/entity/product-variant/product-variant-price.entity.ts @@ -2,6 +2,7 @@ import { CurrencyCode } from '@vendure/common/lib/generated-types'; import { DeepPartial, ID } from '@vendure/common/lib/shared-types'; import { Column, Entity, Index, ManyToOne } from 'typeorm'; +import { CustomProductVariantPriceFields, HasCustomFields } from '../..'; import { VendureEntity } from '../base/base.entity'; import { EntityId } from '../entity-id.decorator'; import { Money } from '../money.decorator'; @@ -16,7 +17,7 @@ import { ProductVariant } from './product-variant.entity'; * @docsCategory entities */ @Entity() -export class ProductVariantPrice extends VendureEntity { +export class ProductVariantPrice extends VendureEntity implements HasCustomFields { constructor(input?: DeepPartial) { super(input); } @@ -31,4 +32,7 @@ export class ProductVariantPrice extends VendureEntity { @Index() @ManyToOne(type => ProductVariant, variant => variant.productVariantPrices, { onDelete: 'CASCADE' }) variant: ProductVariant; + + @Column(type => CustomProductVariantPriceFields) + customFields: CustomProductVariantPriceFields; }