🚨 Announcement: A New Chapter for Vendure read more

ProductOptionService

ProductOptionService

Contains methods relating to ProductOption entities.

Signature

class ProductOptionService {
  constructor(connection: TransactionalConnection, translatableSaver: TranslatableSaver, customFieldRelationService: CustomFieldRelationService, eventBus: EventBus, translator: TranslatorService)
  findAll(ctx: RequestContext) => Promise<Array<Translated<ProductOption>>>;
  findOne(ctx: RequestContext, id: ID) => Promise<Translated<ProductOption> | undefined>;
  async create(ctx: RequestContext, group: ProductOptionGroup | ID, input: CreateGroupOptionInput | CreateProductOptionInput) => Promise<Translated<ProductOption>>;
  async update(ctx: RequestContext, input: UpdateProductOptionInput) => Promise<Translated<ProductOption>>;
  async delete(ctx: RequestContext, id: ID) => Promise<DeletionResponse>;
}

Members

constructor

method
type:
(connection: TransactionalConnection, translatableSaver: TranslatableSaver, customFieldRelationService: CustomFieldRelationService, eventBus: EventBus, translator: TranslatorService) => ProductOptionService

findAll

method
type:
(ctx: RequestContext) => Promise<Array<Translated<ProductOption>>>

findOne

method
type:
(ctx: RequestContext, id: ID) => Promise<Translated<ProductOption> | undefined>

create

async method
type:
(ctx: RequestContext, group: ProductOptionGroup | ID, input: CreateGroupOptionInput | CreateProductOptionInput) => Promise<Translated<ProductOption>>

update

async method
type:
(ctx: RequestContext, input: UpdateProductOptionInput) => Promise<Translated<ProductOption>>

delete

async method
type:
(ctx: RequestContext, id: ID) => Promise<DeletionResponse>

Deletes a ProductOption.

  • If the ProductOption is used by any ProductVariants, the deletion will fail.
  • If the ProductOption is used only by soft-deleted ProductVariants, the option will itself be soft-deleted.
  • If the ProductOption is not used by any ProductVariant at all, it will be hard-deleted.