Skip to main content

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>;
create(ctx: RequestContext, group: ProductOptionGroup | ID, input: CreateGroupOptionInput | CreateProductOptionInput) => Promise<Translated<ProductOption>>;
update(ctx: RequestContext, input: UpdateProductOptionInput) => Promise<Translated<ProductOption>>;
delete(ctx: RequestContext, id: ID) => Promise<DeletionResponse>;
}

constructor

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

findAll

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

findOne

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

create

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

update

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

delete

method
(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.