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_
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.
Parameters
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[]Requireddata
DeepPartial<LineItem>options
objectoptions.setOriginalLineItemId
booleanReturns
create
Create a line item
Parameters
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
a new line item tax line
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
Parameters
Returns
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 & { variantPricing: [ProductVariantPricing](/references/js-client/internal/types/internal.ProductVariantPricing) }RequiredReturns
list
Parameters
config
FindConfig<LineItem>Returns
retrieve
Retrieves a line item by its id.
Parameters
id
stringRequiredthe id of the line item to retrieve
config
objectthe config to be used at query building
Returns
the line item
shouldRetryTransaction_
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
booleanupdate
Updates a line item
Parameters
Returns
the updated line item(s)
validateGenerateArguments
Parameters
variantIdOrData
string | TRequiredquantity
numberReturns
void
voidwithTransaction
Parameters
transactionManager
EntityManagerReturns
Was this section helpful?