addShippingMethods - Cart Module Reference
This documentation provides a reference to the addShippingMethods
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 adds a shipping method to carts.
Example#
1const shippingMethod =2 await cartModuleService.addShippingMethods({3 cart_id: "cart_123",4 name: "UPS",5 amount: 3000,6 })
Parameters#
The shipping method to be created and added to the carts.
The cart is specified in the cart_id
field.
Returns#
The added shipping method.
This method adds shipping methods to carts.
Example#
1const shippingMethods =2 await cartModuleService.addShippingMethods([3 {4 cart_id: "cart_123",5 name: "UPS",6 amount: 3000,7 },8 {9 cart_id: "cart_123",10 name: "FedEx",11 amount: 2000,12 },13 ])
Parameters#
The shipping methods to be created and added to the carts.
The cart is specified in the cart_id
field.
Returns#
The added shipping methods.
addShippingMethods(cartId, methods, sharedContext?): Promise<CartShippingMethodDTO[]>#
This method adds shipping methods to a cart.
Example#
1const shippingMethods =2 await cartModuleService.addShippingMethods("cart_123", [3 {4 name: "UPS",5 amount: 3000,6 },7 {8 name: "FedEx",9 amount: 2000,10 },11 ])
Parameters#
The cart's ID.
The shipping methods to be created and added.
A context used to share resources, such as transaction manager, between the application and the module.
Returns#
The added shipping methods.