Skip to main content
Skip to main content

setShippingMethodAdjustments - Cart Module Reference

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

This method sets the shipping method adjustment of shipping methods in a cart. The existing shipping method adjustments, except those included in the specified list, of an item are removed and replaced with the specified adjustments.

Example

const shippingMethodAdjustments =
await cartModuleService.setShippingMethodAdjustments(
"cart_123",
[
{
id: "casmadj_123",
shipping_method_id: "casm_123",
code: "FREESHIPPING",
},
{
shipping_method_id: "casm_321",
code: "10%OFF",
amount: 1500,
},
]
)

Parameters

cartIdstringRequired
The cart's ID.
The shipping method adjustments to add to the shipping method. If the id field is specified, the adjustment is kept in the shipping method'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<ShippingMethodAdjustmentDTO[]>Required
The added shipping method adjustments.
Was this section helpful?