addLineItems - Cart Module Reference
This documentation provides a reference to the addLineItems
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 line item to a cart
Example#
1const lineItem = await cartModuleService.addLineItems({2 cart_id: "cart_123",3 title: "Shirt",4 quantity: 2,5 unit_price: 4000,6})
Parameters#
The line item to create and add to the cart.
The cart is specified in the cart_id
field.
Returns#
This method adds line items to carts.
Example#
1const lineItems = await cartModuleService.addLineItems([2 {3 cart_id: "cart_123",4 title: "Shirt",5 quantity: 2,6 unit_price: 4000,7 },8 {9 cart_id: "cart_123",10 title: "Pants",11 quantity: 1,12 unit_price: 3000,13 },14])
Parameters#
The line item to create and add to the carts.
The cart is specified in the cart_id
field.
Returns#
addLineItems(cartId, items, sharedContext?): Promise<CartLineItemDTO[]>#
This method adds line items to a cart.
Example#
1const lineItems = await cartModuleService.addLineItems(2 "cart_123",3 [4 {5 title: "Shirt",6 quantity: 2,7 unit_price: 4000,8 },9 {10 title: "Pants",11 quantity: 1,12 unit_price: 3000,13 },14 ]15)
Parameters#
The cart's ID.
The line items to be created and added.
A context used to share resources, such as transaction manager, between the application and the module.
Returns#