LineItemService
Properties
__configModule__Record<string, unknown>__container__anyRequired__moduleDeclaration__Record<string, unknown>cartRepository_Repository<Cart> & { findOneWithRelations: Method findOneWithRelations ; findWithRelations: Method findWithRelations }RequireditemTaxLineRepo_Repository<LineItemTaxLine> & { deleteForCart: Method deleteForCart ; upsertLines: Method upsertLines }Requiredmanager_EntityManagerRequiredtransactionManager_undefined | EntityManagerRequiredAccessors
activeManager_
Inherited from
TransactionBaseService.activeManager_
Methods
atomicPhase_
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.
Parameters
work(transactionManager: EntityManager) => Promise<TResult>Requiredthe transactional work to be done
isolationOrErrorHandlerIsolationLevel | (error: TError) => Promise<void | TResult>the isolation level to be used for the work.
maybeErrorHandlerOrDontFail(error: TError) => Promise<void | TResult>Potential error handler
Returns
PromisePromise<TResult>Requiredthe result of the transactional work
cloneTo
Parameters
idsstring | string[]RequireddataDeepPartial<LineItem>optionsobjectoptions.setOriginalLineItemIdbooleanReturns
create
Create a line item
Parameters
dataTRequiredthe line item object to create
Returns
PromisePromise<TResult>Requiredthe created line item
createReturnLines
Creates return line items for a given cart based on the return items in a return.
Parameters
returnIdstringRequiredthe id to generate return items from.
cartIdstringRequiredthe cart to assign the return line items to.
Returns
the created line items
createTaxLine
Create a line item tax line.
Parameters
tax line partial passed to the repo create method
Returns
a new line item tax line
delete
Deletes a line item.
Parameters
idstringRequiredthe id of the line item to delete
Returns
the result of the delete operation
deleteWithTaxLines
Parameters
idstringRequiredthe id of the line item to delete
Returns
the result of the delete operation
Deprecated
no the cascade on the entity takes care of it Deletes a line item with the tax lines.
generate
Generate a single or multiple line item without persisting the data into the db
Parameters
Returns
PromisePromise<TResult>RequiredgenerateLineItem
Parameters
variantobjectRequiredvariant.idstringRequiredvariant.productobjectRequiredvariant.product.discountablebooleanRequiredvariant.product.is_giftcardbooleanRequiredvariant.product.thumbnailnull | stringRequiredvariant.product.titlestringRequiredvariant.product_idstringRequiredvariant.titlestringRequiredquantitynumberRequiredcontextGenerateLineItemContext & { variantPricing: [ProductVariantPricing](/references/js-client/internal/types/internal.ProductVariantPricing) }RequiredReturns
list
Parameters
configFindConfig<LineItem>Returns
retrieve
Retrieves a line item by its id.
Parameters
idstringRequiredthe id of the line item to retrieve
configobjectthe config to be used at query building
Returns
the line item
shouldRetryTransaction_
Parameters
errRecord<string, unknown> | { code: string }RequiredReturns
booleanbooleanupdate
Updates a line item
Parameters
Returns
the updated line item(s)
validateGenerateArguments
Parameters
variantIdOrDatastring | TRequiredquantitynumberReturns
voidvoidwithTransaction
Parameters
transactionManagerEntityManagerReturns
Was this section helpful?