setLineItemAdjustments - Cart Module Reference
This documentation provides a reference to the setLineItemAdjustments
method. This belongs to the Cart Module.
Note: You should only use this methods when implementing complex customizations. For common cases, check out
available workflows instead.
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#
1const lineItemAdjustments =2 await cartModuleService.setLineItemAdjustments("cart_123", [3 {4 id: "adj_123",5 item_id: "caliadj_123",6 },7 {8 item_id: "caliadj_123",9 code: "10%OFF",10 amount: 2000,11 },12 {13 item_id: "caliadj_321",14 code: "50%OFF",15 amount: 3000,16 },17 ])
Parameters#
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.
A context used to share resources, such as transaction manager, between the application and the module.
Returns#
The added line item adjustments.