Skip to main content
Skip to main content

addShippingMethods - Cart Module Reference

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

addShippingMethods(data): Promise<CartShippingMethodDTO>

This method adds a shipping method to carts.

Example

const shippingMethod =
await cartModuleService.addShippingMethods({
cart_id: "cart_123",
name: "UPS",
amount: 3000,
})

Parameters

The shipping method to be created and added to the carts. The cart is specified in the cart_id field.

Returns

PromisePromise<CartShippingMethodDTO>Required
The added shipping method.

addShippingMethods(data): Promise<CartShippingMethodDTO[]>

This method adds shipping methods to carts.

Example

const shippingMethods =
await cartModuleService.addShippingMethods([
{
cart_id: "cart_123",
name: "UPS",
amount: 3000,
},
{
cart_id: "cart_123",
name: "FedEx",
amount: 2000,
},
])

Parameters

The shipping methods to be created and added to the carts. The cart is specified in the cart_id field.

Returns

PromisePromise<CartShippingMethodDTO[]>Required
The added shipping methods.

addShippingMethods(cartId, methods, sharedContext?): Promise<CartShippingMethodDTO[]>

This method adds shipping methods to a cart.

Example

const shippingMethods =
await cartModuleService.addShippingMethods("cart_123", [
{
name: "UPS",
amount: 3000,
},
{
name: "FedEx",
amount: 2000,
},
])

Parameters

cartIdstringRequired
The cart's ID.
The shipping methods to be created and added.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<CartShippingMethodDTO[]>Required
The added shipping methods.
Was this section helpful?