ProductCategoryService
Provides layer to manipulate product categories.
constructor
Parameters
__namedParameters
InjectedDependenciesRequiredProperties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>manager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequiredEvents
objectRequiredEvents.CREATED
stringRequiredDefault: "product-category.created"
Events.DELETED
stringRequiredDefault: "product-category.deleted"
Events.UPDATED
stringRequiredDefault: "product-category.updated"
Accessors
activeManager_
Returns
EntityManager
EntityManagerRequiredMethods
addProducts
Add a batch of product to a product category
Parameters
productCategoryId
stringRequiredproductIds
string[]RequiredReturns
Promise
Promise<void>RequiredatomicPhase_
Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created.
Type Parameters
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise
Promise<TResult>Requiredcreate
Creates a product category
Parameters
productCategoryInput
CreateProductCategoryInputRequiredReturns
delete
Deletes a product category
Parameters
productCategoryId
stringRequiredReturns
Promise
Promise<void>RequiredfetchReorderConditions
Parameters
input
UpdateProductCategoryInputRequiredshouldDeleteElement
booleanRequiredDefault: false
Returns
ReorderConditions
ReorderConditionsRequiredlistAndCount
Lists product category based on the provided parameters and includes the count of product category that match the query.
Parameters
Default: {}
Returns
performReordering
Parameters
conditions
ReorderConditionsRequiredReturns
Promise
Promise<void>RequiredremoveProducts
Remove a batch of product from a product category
Parameters
productCategoryId
stringRequiredproductIds
string[]RequiredReturns
Promise
Promise<void>Requiredretrieve
Retrieves a product category by id.
Parameters
productCategoryId
stringRequiredDefault: {}
Default: {}
Default: {}
Returns
retrieveByHandle
Retrieves a product category by handle.
Parameters
handle
stringRequiredDefault: {}
Default: {}
Default: {}
Returns
retrieve_
A generic retrieve for fining product categories by different attributes.
Parameters
Default: {}
Default: {}
Default: {}
Returns
shiftSiblings
Parameters
conditions
ReorderConditionsRequiredReturns
Promise
Promise<void>RequiredshouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleantransformParentIdToEntity
Accepts an input object and transforms product_category_id into product_category entity.
Parameters
productCategoryInput
CreateProductCategoryInput | UpdateProductCategoryInputRequiredReturns
Promise
Promise<CreateProductCategoryInput | UpdateProductCategoryInput>Requiredupdate
Updates a product category
Parameters
productCategoryId
stringRequiredproductCategoryInput
UpdateProductCategoryInputRequiredReturns
withTransaction
Parameters
transactionManager
EntityManagerReturns
ProductCategoryService
objectRequired