Skip to main content
Skip to main content

setLineItemAdjustments - Cart Module Reference

This documentation provides a reference to the setLineItemAdjustments method. This belongs to the Cart Module.

This method set the line item adjustments of line items in a cart. The existing line item adjustments, except those included in the specified list, of an item are removed and replaced with the specified adjustments.

Example

const lineItemAdjustments =
await cartModuleService.setLineItemAdjustments("cart_123", [
{
id: "adj_123",
item_id: "caliadj_123",
},
{
item_id: "caliadj_123",
code: "10%OFF",
amount: 2000,
},
{
item_id: "caliadj_321",
code: "50%OFF",
amount: 3000,
},
])

Parameters

cartIdstringRequired
The cart's ID.
The line item adjustments to add to the line items. The line item is specified by the item_id field. If the id field is specified, the adjustment is kept in the line item's adjustment and its attributes can be updated.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<LineItemAdjustmentDTO[]>Required
The added line item adjustments.
Was this section helpful?