LineItemService
constructor
Parameters
__namedParameters
InjectedDependenciesRequiredProperties
manager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequired__container__
anyRequiredfeatureFlagRouter_
FlagRouterRequired__configModule__
Record<string, unknown>__moduleDeclaration__
Record<string, unknown>Accessors
activeManager_
Returns
EntityManager
EntityManagerRequiredMethods
withTransaction
Parameters
transactionManager
EntityManagerReturns
this
thisRequiredshouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanRequiredatomicPhase_
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>Requiredlist
Parameters
Returns
retrieve
Retrieves a line item by its id.
Parameters
id
stringRequiredconfig
objectRequiredDefault: {}
Returns
createReturnLines
Creates return line items for a given cart based on the return items in a return.
Parameters
returnId
stringRequiredcartId
stringRequiredReturns
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.title
stringRequiredvariant.product_id
stringRequiredvariant.product
objectRequiredvariant.product.title
stringRequiredvariant.product.thumbnail
null | stringRequiredvariant.product.discountable
booleanRequiredvariant.product.is_giftcard
booleanRequiredquantity
numberRequiredcontext
GenerateLineItemContext & objectRequiredReturns
create
Create a line item
Type Parameters
T
objectRequiredTResult
objectRequiredParameters
data
TRequiredReturns
Promise
Promise<TResult>Requiredupdate
Updates a line item
Parameters
Returns
delete
**delete**(ids): Promise<[LineItem](../../entities/classes/entities.LineItem.mdx)[]>
Deletes a line item.
Parameters
ids
string[]RequiredReturns
**delete**(id): Promise<void \| [LineItem](../../entities/classes/entities.LineItem.mdx)>
Deletes a line item.
Parameters
id
stringRequiredReturns
deleteWithTaxLines
Parameters
id
stringRequiredReturns
Deprecated
no the cascade on the entity takes care of it Deletes a line item with the tax lines.
createTaxLine
Create a line item tax line.
Parameters
Returns
LineItemTaxLine
objectRequiredcloneTo
Parameters
ids
string | string[]RequiredDefault: {}
options
objectRequiredoptions.setOriginalLineItemId
booleanReturns
validateGenerateArguments
Type Parameters
T
objectRequiredTResult
objectRequiredParameters
variantIdOrData
string | TRequiredregionIdOrContext
T extends string ? string : GenerateLineItemContextRequiredquantity
numberReturns
void
voidRequired