LineItemService
constructor
Parameters
__namedParameters
InjectedDependenciesRequiredProperties
__container__
anyRequiredfeatureFlagRouter_
FlagRouterRequiredmanager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequired__configModule__
Record<string, unknown>__moduleDeclaration__
Record<string, unknown>Accessors
activeManager_
Returns
EntityManager
EntityManagerRequiredMethods
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.
Type Parameters
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>Requiredthe transactional work to be done
isolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>the isolation level to be used for the work.
maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Potential error handler
Returns
Promise
Promise<TResult>Requiredthe result of the transactional work
cloneTo
Parameters
ids
string | string[]RequiredDefault: {}
options
objectRequiredoptions.setOriginalLineItemId
booleanReturns
create
Create a line item
Type Parameters
T
objectRequiredTResult
objectRequiredParameters
data
TRequiredthe line item object to create
Returns
Promise
Promise<TResult>Requiredthe created line item
createReturnLines
Creates return line items for a given cart based on the return items in a return.
Parameters
returnId
stringRequiredthe id to generate return items from.
cartId
stringRequiredthe 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
LineItemTaxLine
objectRequiredA Line Item Tax Line represents the taxes applied on a line item.
delete
Deletes a line item.
Parameters
id
stringRequiredthe id of the line item to delete
Returns
the result of the delete operation
deleteWithTaxLines
Parameters
id
stringRequiredthe 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
Type Parameters
T
objectRequiredTResult
objectRequiredParameters
variantIdOrData
TRequiredregionIdOrContext
T extends string ? string : GenerateLineItemContextRequiredcontext
GenerateLineItemContextRequiredDefault: {}
quantity
numberReturns
Promise
Promise<TResult>RequiredgenerateLineItem
Parameters
variant
objectRequiredvariant.id
stringRequiredvariant.product
objectRequiredvariant.product.discountable
booleanRequiredvariant.product.is_giftcard
booleanRequiredvariant.product.thumbnail
null | stringRequiredvariant.product.title
stringRequiredvariant.product_id
stringRequiredvariant.title
stringRequiredquantity
numberRequiredcontext
GenerateLineItemContext & objectRequiredReturns
list
Parameters
Returns
retrieve
Retrieves a line item by its id.
Parameters
id
stringRequiredthe id of the line item to retrieve
config
objectRequiredthe config to be used at query building
Default: {}
Returns
the line item
shouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanRequiredupdate
Updates a line item
Parameters
Returns
the updated line item(s)
validateGenerateArguments
Type Parameters
T
objectRequiredTResult
objectRequiredParameters
variantIdOrData
string | TRequiredregionIdOrContext
T extends string ? string : GenerateLineItemContextRequiredquantity
numberReturns
void
voidRequiredwithTransaction
Parameters
transactionManager
EntityManagerReturns
LineItemService
objectRequiredWas this section helpful?