Skip to main content
Skip to main content

addShippingMethodAdjustments - Cart Module Reference

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

addShippingMethodAdjustments(data): Promise<ShippingMethodAdjustmentDTO[]>

This method adds shipping method adjustments to shipping methods.

Example

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

Parameters

The shipping method adjustments to be created and added to shipping methods. The shipping method is specified by the shipping_method_id field.

Returns

PromisePromise<ShippingMethodAdjustmentDTO[]>Required
The added shipping method adjustments.

addShippingMethodAdjustments(data): Promise<ShippingMethodAdjustmentDTO>

This method adds a shipping method adjustment to a shipping method.

Example

const shippingMethodAdjustment =
await cartModuleService.addShippingMethodAdjustments({
shipping_method_id: "casm_123",
code: "FREESHIPPING",
amount: 3000,
})

Parameters

The shipping method adjustment to be created and added to a shipping method. The shipping method is specified by the shipping_method_id field.

Returns

PromisePromise<ShippingMethodAdjustmentDTO>Required
The added shipping method adjustment.

addShippingMethodAdjustments(cartId, data, sharedContext?): Promise<ShippingMethodAdjustmentDTO[]>

This method adds shipping method adjustments to shipping methods in a cart.

Example

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

Parameters

cartIdstringRequired
The cart's ID.
The shipping method adjustments to be created and added to shipping methods. The shipping method is specified by the shipping_method_id field.
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?