Skip to main content

ProductService

Contains methods relating to Product entities.

Signature

constructor

method(connection: TransactionalConnection, channelService: ChannelService, assetService: AssetService, productVariantService: ProductVariantService, facetValueService: FacetValueService, listQueryBuilder: ListQueryBuilder, translatableSaver: TranslatableSaver, eventBus: EventBus, slugValidator: SlugValidator, customFieldRelationService: CustomFieldRelationService, translator: TranslatorService, productOptionGroupService: ProductOptionGroupService) => ProductService

findAll

method(ctx: RequestContext, options?: ListQueryOptions<Product>, relations?: RelationPaths<Product>) => Promise<PaginatedList<Translated<Product>>>

findOne

method(ctx: RequestContext, productId: ID, relations?: RelationPaths<Product>) => Promise<Translated<Product> | undefined>

findByIds

method(ctx: RequestContext, productIds: ID[], relations?: RelationPaths<Product>) => Promise<Array<Translated<Product>>>

getProductChannels

method(ctx: RequestContext, productId: ID) => Promise<Channel[]>

Returns all Channels to which the Product is assigned.

getFacetValuesForProduct

method(ctx: RequestContext, productId: ID) => Promise<Array<Translated<FacetValue>>>

findOneBySlug

method(ctx: RequestContext, slug: string, relations?: RelationPaths<Product>) => Promise<Translated<Product> | undefined>

create

method(ctx: RequestContext, input: CreateProductInput) => Promise<Translated<Product>>

update

method(ctx: RequestContext, input: UpdateProductInput) => Promise<Translated<Product>>

softDelete

method(ctx: RequestContext, productId: ID) => Promise<DeletionResponse>

assignProductsToChannel

method(ctx: RequestContext, input: AssignProductsToChannelInput) => Promise<Array<Translated<Product>>>

Assigns a Product to the specified Channel, and optionally uses a priceFactor to set the ProductVariantPrices on the new Channel.

Internally, this method will also call ProductVariantService assignProductVariantsToChannel() for each of the Product's variants, and will assign the Product's Assets to the Channel too.

removeProductsFromChannel

method(ctx: RequestContext, input: RemoveProductsFromChannelInput) => Promise<Array<Translated<Product>>>

addOptionGroupToProduct

method(ctx: RequestContext, productId: ID, optionGroupId: ID) => Promise<Translated<Product>>

removeOptionGroupFromProduct

method(ctx: RequestContext, productId: ID, optionGroupId: ID, force?: boolean) => Promise<ErrorResultUnion<RemoveOptionGroupFromProductResult, Translated<Product>>>
Was this chapter helpful?
Report Issue
Edited Feb 25, 2026ยทEdit this page