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>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise
Promise<TResult>RequiredcloneTo
Parameters
ids
string | string[]RequiredDefault: {}
options
objectRequiredoptions.setOriginalLineItemId
booleanReturns
create
Create a line item
Type Parameters
T
objectRequiredTResult
objectRequiredParameters
data
TRequiredReturns
Promise
Promise<TResult>RequiredcreateReturnLines
Creates return line items for a given cart based on the return items in a return.
Parameters
returnId
stringRequiredcartId
stringRequiredReturns
createTaxLine
Create a line item tax line.
Parameters
Returns
LineItemTaxLine
objectRequireddelete
**delete**(ids): Promise<[LineItem](/references/entities/classes/LineItem)[]>
Deletes a line item.
Parameters
ids
string[]RequiredReturns
**delete**(id): Promise<void \| [LineItem](/references/entities/classes/LineItem)>
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.
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
stringRequiredconfig
objectRequiredDefault: {}
Returns
shouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanRequiredupdate
Updates a line item
Parameters
Returns
validateGenerateArguments
Type Parameters
T
objectRequiredTResult
objectRequiredParameters
variantIdOrData
string | TRequiredregionIdOrContext
T extends string ? string : GenerateLineItemContextRequiredquantity
numberReturns
void
voidRequiredwithTransaction
Parameters
transactionManager
EntityManagerReturns
this
thisRequired