---
title: "ProductOptionService"
generated: true
---
<GenerationInfo sourceFile="packages/core/src/service/services/product-option.service.ts" sourceLine="37" packageName="@vendure/core" />

Contains methods relating to <DocsLink href="/reference/typescript-api/entities/product-option#productoption">ProductOption</DocsLink> entities.

```ts title="Signature"
class ProductOptionService {
    constructor(connection: TransactionalConnection, translatableSaver: TranslatableSaver, customFieldRelationService: CustomFieldRelationService, eventBus: EventBus, translator: TranslatorService, listQueryBuilder: ListQueryBuilder)
    findAll(ctx: RequestContext, options?: ListQueryOptions<ProductOption>, groupId?: ID, relations?: RelationPaths<ProductOption>) => Promise<PaginatedList<Translated<ProductOption>>>;
    findOne(ctx: RequestContext, id: ID, relations?: RelationPaths<ProductOption>) => 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>;
}
```

<div className="members-wrapper">

### constructor

<MemberInfo kind="method" type={`(connection: <a href='/reference/typescript-api/data-access/transactional-connection#transactionalconnection'>TransactionalConnection</a>, translatableSaver: <a href='/reference/typescript-api/service-helpers/translatable-saver#translatablesaver'>TranslatableSaver</a>, customFieldRelationService: CustomFieldRelationService, eventBus: <a href='/reference/typescript-api/events/event-bus#eventbus'>EventBus</a>, translator: <a href='/reference/typescript-api/service-helpers/translator-service#translatorservice'>TranslatorService</a>, listQueryBuilder: <a href='/reference/typescript-api/data-access/list-query-builder#listquerybuilder'>ListQueryBuilder</a>) => ProductOptionService`}   />


### findAll

<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, options?: ListQueryOptions<<a href='/reference/typescript-api/entities/product-option#productoption'>ProductOption</a>>, groupId?: <a href='/reference/typescript-api/common/id#id'>ID</a>, relations?: RelationPaths<<a href='/reference/typescript-api/entities/product-option#productoption'>ProductOption</a>>) => Promise<<a href='/reference/typescript-api/common/paginated-list#paginatedlist'>PaginatedList</a><Translated<<a href='/reference/typescript-api/entities/product-option#productoption'>ProductOption</a>>>>`}   />


### findOne

<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, id: <a href='/reference/typescript-api/common/id#id'>ID</a>, relations?: RelationPaths<<a href='/reference/typescript-api/entities/product-option#productoption'>ProductOption</a>>) => Promise<Translated<<a href='/reference/typescript-api/entities/product-option#productoption'>ProductOption</a>> | undefined>`}   />


### create

<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, group: <a href='/reference/typescript-api/entities/product-option-group#productoptiongroup'>ProductOptionGroup</a> | <a href='/reference/typescript-api/common/id#id'>ID</a>, input: CreateGroupOptionInput | CreateProductOptionInput) => Promise<Translated<<a href='/reference/typescript-api/entities/product-option#productoption'>ProductOption</a>>>`}   />


### update

<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, input: UpdateProductOptionInput) => Promise<Translated<<a href='/reference/typescript-api/entities/product-option#productoption'>ProductOption</a>>>`}   />


### delete

<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, id: <a href='/reference/typescript-api/common/id#id'>ID</a>) => 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.


</div>
