Skip to main content
Skip to main content
You're viewing the documentation for v1, which isn't the latest Medusa version.Latest documentation

ICartModuleService

The main service interface for the Cart Module.

Methods

retrieve

This method retrieves a cart by its ID.

Example

A simple example that retrieves a cart by its ID:

const cart = await cartModuleService.retrieve("cart_123")

To specify relations that should be retrieved:

const cart = await cartModuleService.retrieve("cart_123", {
relations: ["shipping_address"],
})

Parameters

cartIdstringRequired
The cart's ID.
The configurations determining how the cart is retrieved. Its properties, such as select or relations, accept the attributes or relations associated with a cart.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<CartDTO>Required
The retrieved cart.

list

This method retrieves a paginated list of carts based on optional filters and configuration.

Example

To retrieve a list of carts using their IDs:

const carts = await cartModuleService.list({
id: ["cart_123", "cart_321"],
})

To specify relations that should be retrieved within the carts:

const carts = await cartModuleService.list(
{
id: ["cart_123", "cart_321"],
},
{
relations: ["shipping_address"],
}
)

By default, only the first 15 records are retrieved. You can control pagination by specifying the skip and take properties of the config parameter:

const carts = await cartModuleService.list(
{
id: ["cart_123", "cart_321"],
},
{
relations: ["shipping_address"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved carts.
The configurations determining how the cart is retrieved. Its properties, such as select or relations, accept the attributes or relations associated with a cart.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<CartDTO[]>Required
The list of carts.

listAndCount

This method retrieves a paginated list of carts along with the total count of available carts satisfying the provided filters.

Example

To retrieve a list of carts using their IDs:

const [carts, count] = await cartModuleService.listAndCount({
id: ["cart_123", "cart_321"],
})

To specify relations that should be retrieved within the carts:

const [carts, count] = await cartModuleService.listAndCount(
{
id: ["cart_123", "cart_321"],
},
{
relations: ["shipping_address"],
}
)

By default, only the first 15 records are retrieved. You can control pagination by specifying the skip and take properties of the config parameter:

const [carts, count] = await cartModuleService.listAndCount(
{
id: ["cart_123", "cart_321"],
},
{
relations: ["shipping_address"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved carts.
The configurations determining how the cart is retrieved. Its properties, such as select or relations, accept the attributes or relations associated with a cart.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<[CartDTO[], number]>Required
The list of carts along with their total count.

create

**create**(data, sharedContext?): Promise&#60;[CartDTO](types.CartTypes.CartDTO.mdx)[]&#62;

This method creates carts.

Example

const carts = await cartModuleService.create([
{
currency_code: "usd",
},
{
currency_code: "eur",
},
])

Parameters

dataCreateCartDTO[]Required
The carts to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<CartDTO[]>Required
The created carts.

**create**(data, sharedContext?): Promise&#60;[CartDTO](types.CartTypes.CartDTO.mdx)&#62;

This method creates a cart.

Example

const cart = await cartModuleService.create({
currency_code: "usd",
})

Parameters

dataCreateCartDTORequired
The cart to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<CartDTO>Required
The created cart.

update

**update**(data): Promise&#60;[CartDTO](types.CartTypes.CartDTO.mdx)[]&#62;

This method updates existing carts.

Example

const carts = await cartModuleService.update([
{
id: "cart_123",
region_id: "reg_123",
},
{
id: "cart_321",
customer_id: "cus_123",
},
])

Parameters

dataUpdateCartDTO[]Required
The attributes to update in the carts.

Returns

PromisePromise<CartDTO[]>Required
The updated carts.

**update**(cartId, data, sharedContext?): Promise&#60;[CartDTO](types.CartTypes.CartDTO.mdx)&#62;

This method updates an existing cart.

Example

const cart = await cartModuleService.update("cart_123", {
region_id: "reg_123",
})

Parameters

cartIdstringRequired
The cart's ID.
dataUpdateCartDataDTORequired
The attributes to update in the cart data.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<CartDTO>Required
The updated cart.

**update**(selector, data, sharedContext?): Promise&#60;[CartDTO](types.CartTypes.CartDTO.mdx)[]&#62;

This method updates existing carts matching the specified filters.

Example

const carts = await cartModuleService.update(
{
currency_code: "usd",
},
{
region_id: "reg_123",
}
)

Parameters

selectorPartial<CartDTO>Required
The filters that specify which carts to update.
dataUpdateCartDataDTORequired
The attributes to update in the carts.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<CartDTO[]>Required
The updated carts.

delete

**delete**(cartIds, sharedContext?): Promise&#60;void&#62;

This method deletes carts by their IDs.

Example

await cartModuleService.delete(["cart_123", "cart_321"])

Parameters

cartIdsstring[]Required
The list of cart IDs.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the carts are deleted successfully.

**delete**(cartId, sharedContext?): Promise&#60;void&#62;

This method deletes a cart by its ID.

Example

await cartModuleService.delete("cart_123")

Parameters

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

Returns

PromisePromise<void>Required
Resolves when the carts are deleted successfully.

**delete**(ids, sharedContext?): Promise&#60;void&#62;

This method deletes carts by their IDs.

Example

await cartModuleService.delete(["cart_123", "cart_321"])

Parameters

idsstring[]Required
The IDs of the cart.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the carts are deleted successfully.

**delete**(id, sharedContext?): Promise&#60;void&#62;

This method deletes a cart by its ID.

Example

await cartModuleService.delete("cart_123")

Parameters

idstringRequired
The ID of the cart.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when a cart is deleted successfully.

listAddresses

This method retrieves a paginated list of addresses based on optional filters and configuration.

Example

To retrieve a list of addresses using their IDs:

const addresses = await cartModuleService.listAddresses({
id: ["caaddr_123", "caaddr_321"],
})

By default, only the first 15 records are retrieved. You can control pagination by specifying the skip and take properties of the config parameter:

const addresses = await cartModuleService.listAddresses(
{
id: ["caaddr_123", "caaddr_321"],
},
{
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved addresss.
The configurations determining how the address is retrieved. Its properties, such as select or relations, accept the attributes or relations associated with a address.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<CartAddressDTO[]>Required
The list of addresses.

createAddresses

**createAddresses**(data, sharedContext?): Promise&#60;[CartAddressDTO](types.CartTypes.CartAddressDTO.mdx)[]&#62;

This method creates addresses.

Example

const addresses = await cartModuleService.createAddresses([
{
address_1: "412 E Cheyenne Rd",
country_code: "us",
},
{
first_name: "Genevieve",
last_name: "Fox",
address_1: "17350 Northwest Fwy",
country_code: "us",
},
])

Parameters

dataCreateAddressDTO[]Required
The addresss to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<CartAddressDTO[]>Required
The created addresses.

**createAddresses**(data, sharedContext?): Promise&#60;[CartAddressDTO](types.CartTypes.CartAddressDTO.mdx)&#62;

This method creates a address.

Example

const address = await cartModuleService.createAddresses({
first_name: "Genevieve",
last_name: "Fox",
address_1: "17350 Northwest Fwy",
country_code: "us",
})

Parameters

dataCreateAddressDTORequired
The address to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<CartAddressDTO>Required
The created address.

updateAddresses

**updateAddresses**(data, sharedContext?): Promise&#60;[CartAddressDTO](types.CartTypes.CartAddressDTO.mdx)[]&#62;

This method updates existing addresses.

Example

const addresses = await cartModuleService.updateAddresses([
{
id: "caaddr_123",
first_name: "Leroy",
},
{
id: "caaddr_321",
last_name: "Hunt",
},
])

Parameters

dataUpdateAddressDTO[]Required
The attributes to update in the addresss.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<CartAddressDTO[]>Required
The updated addresses.

**updateAddresses**(data, sharedContext?): Promise&#60;[CartAddressDTO](types.CartTypes.CartAddressDTO.mdx)&#62;

This method updates an existing address.

Example

const address = await cartModuleService.updateAddresses({
id: "caaddr_123",
first_name: "Leroy",
})

Parameters

dataUpdateAddressDTORequired
The attributes to update in the address.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<CartAddressDTO>Required
The updated address.

deleteAddresses

**deleteAddresses**(ids, sharedContext?): Promise&#60;void&#62;

This method deletes addresses by their IDs.

Example

await cartModuleService.deleteAddresses([
"caaddr_123",
"caaddr_321",
])

Parameters

idsstring[]Required
The IDs of the cart.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the addresses are deleted successfully.

**deleteAddresses**(ids, sharedContext?): Promise&#60;void&#62;

This method deletes an address by its ID.

Example

await cartModuleService.deleteAddresses("caaddr_123")

Parameters

idsstringRequired
The IDs of the cart.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the address are deleted successfully.

retrieveLineItem

This method retrieves a line item by its ID.

Example

A simple example that retrieves a line item by its ID:

const lineItem =
await cartModuleService.retrieveLineItem("cali_123")

To specify relations that should be retrieved:

const lineItem = await cartModuleService.retrieveLineItem(
"cali_123",
{
relations: ["cart"],
}
)

Parameters

itemIdstringRequired
The item's ID.
The configurations determining how the line item is retrieved. Its properties, such as select or relations, accept the attributes or relations associated with a line item.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<CartLineItemDTO>Required
The retrieved line item.

listLineItems

This method retrieves a paginated list of line items based on optional filters and configuration.

Example

To retrieve a list of line items using their IDs:

const lineItems = await cartModuleService.listLineItems({
id: ["cali_123", "cali_321"],
})

To specify relations that should be retrieved within the line items:

const lineItems = await cartModuleService.listLineItems(
{
id: ["cali_123", "cali_321"],
},
{
relations: ["cart"],
}
)

By default, only the first 15 records are retrieved. You can control pagination by specifying the skip and take properties of the config parameter:

const lineItems = await cartModuleService.listLineItems(
{
id: ["cali_123", "cali_321"],
},
{
relations: ["cart"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved line items.
The configurations determining how the line item is retrieved. Its properties, such as select or relations, accept the attributes or relations associated with a line item.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<CartLineItemDTO[]>Required
The list of line items.

addLineItems

**addLineItems**(data): Promise&#60;[CartLineItemDTO](types.CartTypes.CartLineItemDTO.mdx)[]&#62;

This method adds a line item to a cart

Example

const lineItem = await cartModuleService.addLineItems({
cart_id: "cart_123",
title: "Shirt",
quantity: 2,
unit_price: 4000,
})

Parameters

The line item to create and add to the cart. The cart is specified in the cart_id field.

Returns

PromisePromise<CartLineItemDTO[]>Required
The added line item.

**addLineItems**(data): Promise&#60;[CartLineItemDTO](types.CartTypes.CartLineItemDTO.mdx)[]&#62;

This method adds line items to carts.

Example

const lineItems = await cartModuleService.addLineItems([
{
cart_id: "cart_123",
title: "Shirt",
quantity: 2,
unit_price: 4000,
},
{
cart_id: "cart_123",
title: "Pants",
quantity: 1,
unit_price: 3000,
},
])

Parameters

The line item to create and add to the carts. The cart is specified in the cart_id field.

Returns

PromisePromise<CartLineItemDTO[]>Required
The added line items.

**addLineItems**(cartId, items, sharedContext?): Promise&#60;[CartLineItemDTO](types.CartTypes.CartLineItemDTO.mdx)[]&#62;

This method adds line items to a cart.

Example

const lineItems = await cartModuleService.addLineItems(
"cart_123",
[
{
title: "Shirt",
quantity: 2,
unit_price: 4000,
},
{
title: "Pants",
quantity: 1,
unit_price: 3000,
},
]
)

Parameters

cartIdstringRequired
The cart's ID.
itemsCreateLineItemDTO[]Required
The line items to be created and added.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<CartLineItemDTO[]>Required
The added line items.

updateLineItems

**updateLineItems**(data): Promise&#60;[CartLineItemDTO](types.CartTypes.CartLineItemDTO.mdx)[]&#62;

This method updates existing line items.

Example

const lineItems = await cartModuleService.updateLineItems([
{
selector: {
id: "cali_123",
},
data: {
quantity: 2,
},
},
{
selector: {
variant_sku: "PANTS",
},
data: {
unit_price: 3000,
},
},
])

Parameters

A list of objects, each holding the filters that specify which items to update, and the attributes to update in the items.

Returns

PromisePromise<CartLineItemDTO[]>Required
The updated line items.

**updateLineItems**(selector, data, sharedContext?): Promise&#60;[CartLineItemDTO](types.CartTypes.CartLineItemDTO.mdx)[]&#62;

This method updates existing line items matching the specified filters.

Example

const lineItems = await cartModuleService.updateLineItems(
{
variant_sku: "PANTS",
},
{
unit_price: 4000,
}
)

Parameters

selectorPartial<CartLineItemDTO>Required
The filters that specify which line items to update.
dataPartial<UpdateLineItemDTO>Required
The attributes to update in the line items.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<CartLineItemDTO[]>Required
The updated line items.

**updateLineItems**(lineId, data, sharedContext?): Promise&#60;[CartLineItemDTO](types.CartTypes.CartLineItemDTO.mdx)&#62;

This method updates an existing line item.

Example

const lineItem = await cartModuleService.updateLineItems(
"cali_123",
{
unit_price: 3000,
}
)

Parameters

lineIdstringRequired
The line item's ID.
dataPartial<UpdateLineItemDTO>Required
The attributes to update in the line item.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<CartLineItemDTO>Required
The updated line item.

listShippingMethods

This method retrieves a paginated list of shipping methods based on optional filters and configuration.

Example

To retrieve a list of shipping methods using their IDs:

const shippingMethods =
await cartModuleService.listShippingMethods(
{
id: ["casm_123", "casm_321"],
},
{}
)

To specify relations that should be retrieved within the shipping methods:

const shippingMethods =
await cartModuleService.listShippingMethods(
{
id: ["casm_123", "casm_321"],
},
{
relations: ["cart"],
}
)

By default, only the first 15 records are retrieved. You can control pagination by specifying the skip and take properties of the config parameter:

const shippingMethods =
await cartModuleService.listShippingMethods(
{
id: ["casm_123", "casm_321"],
},
{
relations: ["cart"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved shipping methods.
The configurations determining how the shipping method is retrieved. Its properties, such as select or relations, accept the attributes or relations associated with a shipping method.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<CartShippingMethodDTO[]>Required
The list of shipping methods.

addShippingMethods

**addShippingMethods**(data): Promise&#60;[CartShippingMethodDTO](types.CartTypes.CartShippingMethodDTO.mdx)&#62;

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&#60;[CartShippingMethodDTO](types.CartTypes.CartShippingMethodDTO.mdx)[]&#62;

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&#60;[CartShippingMethodDTO](types.CartTypes.CartShippingMethodDTO.mdx)[]&#62;

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.

listLineItemAdjustments

This method retrieves a paginated list of line item adjustments based on optional filters and configuration.

Example

To retrieve a list of line item adjustments using their IDs:

const lineItemAdjustments =
await cartModuleService.listLineItemAdjustments({
id: ["caliadj_123", "caliadj_321"],
})

To specify relations that should be retrieved within the line item adjustments:

const lineItemAdjustments =
await cartModuleService.listLineItemAdjustments(
{
id: ["caliadj_123", "caliadj_321"],
},
{
relations: ["item"],
}
)

By default, only the first 15 records are retrieved. You can control pagination by specifying the skip and take properties of the config parameter:

const lineItemAdjustments =
await cartModuleService.listLineItemAdjustments(
{
id: ["caliadj_123", "caliadj_321"],
},
{
relations: ["item"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved line item adjustments.
The configurations determining how the line item adjustment is retrieved. Its properties, such as select or relations, accept the attributes or relations associated with a line item adjustment.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<LineItemAdjustmentDTO[]>Required
The list of line item adjustments.

addLineItemAdjustments

**addLineItemAdjustments**(data): Promise&#60;[LineItemAdjustmentDTO](types.CartTypes.LineItemAdjustmentDTO.mdx)[]&#62;

This method adds line item adjustments to line items.

Example

const lineItemAdjustments =
await cartModuleService.addLineItemAdjustments([
{
item_id: "caliadj_123",
code: "50%OFF",
amount: 3000,
},
{
item_id: "caliadj_321",
code: "10%OFF",
amount: 3000,
},
])

Parameters

The line item adjustments to be created and added to line items. The line item is specified by the item_id field.

Returns

PromisePromise<LineItemAdjustmentDTO[]>Required
The added line item adjustments.

**addLineItemAdjustments**(data): Promise&#60;[LineItemAdjustmentDTO](types.CartTypes.LineItemAdjustmentDTO.mdx)[]&#62;

This method adds a line item adjustment to a line item.

Example

const lineItemAdjustments =
await cartModuleService.addLineItemAdjustments({
item_id: "caliadj_123",
code: "50%OFF",
amount: 3000,
})

Parameters

The line item adjustment to be created and added to a line item. The line item is specified by the item_id field.

Returns

PromisePromise<LineItemAdjustmentDTO[]>Required
The added line item adjustment.

**addLineItemAdjustments**(cartId, data): Promise&#60;[LineItemAdjustmentDTO](types.CartTypes.LineItemAdjustmentDTO.mdx)[]&#62;

This method adds line item adjustments to line items in a cart.

Example

const lineItemAdjustments =
await cartModuleService.addLineItemAdjustments("cart_123", [
{
item_id: "caliadj_123",
code: "50%OFF",
amount: 3000,
},
{
item_id: "caliadj_321",
code: "10%OFF",
amount: 2000,
},
])

Parameters

cartIdstringRequired
The cart's ID.
The line item adjustments to be created and added to line items. The line item is specified by the item_id field.

Returns

PromisePromise<LineItemAdjustmentDTO[]>Required
The added line item adjustment.

setLineItemAdjustments

This method set the line item adjustments of line items in a cart. The existing line item adjustments, except those included in the specified list, of an item are removed and replaced with the specified adjustments.

Example

const lineItemAdjustments =
await cartModuleService.setLineItemAdjustments("cart_123", [
{
id: "adj_123",
item_id: "caliadj_123",
},
{
item_id: "caliadj_123",
code: "10%OFF",
amount: 2000,
},
{
item_id: "caliadj_321",
code: "50%OFF",
amount: 3000,
},
])

Parameters

cartIdstringRequired
The cart's ID.
The line item adjustments to add to the line items. The line item is specified by the item_id field. If the id field is specified, the adjustment is kept in the line item'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<LineItemAdjustmentDTO[]>Required
The added line item adjustments.

listShippingMethodAdjustments

This method retrieves a paginated list of shipping method adjustments based on optional filters and configuration.

Example

To retrieve a list of shipping method adjustments using their IDs:

const shippingMethodAdjustments =
await cartModuleService.listShippingMethodAdjustments({
id: ["casmadj_123", "casmadj_321"],
})

To specify relations that should be retrieved within the shipping method adjustments:

const shippingMethodAdjustments =
await cartModuleService.listShippingMethodAdjustments(
{
id: ["casmadj_123", "casmadj_321"],
},
{
relations: ["shipping_method"],
}
)

By default, only the first 15 records are retrieved. You can control pagination by specifying the skip and take properties of the config parameter:

const shippingMethodAdjustments =
await cartModuleService.listShippingMethodAdjustments(
{
id: ["casmadj_123", "casmadj_321"],
},
{
relations: ["shipping_method"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved shipping method adjustments.
The configurations determining how the shipping method adjustment is retrieved. Its properties, such as select or relations, accept the attributes or relations associated with a shipping method adjustment.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

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

addShippingMethodAdjustments

**addShippingMethodAdjustments**(data): Promise&#60;[ShippingMethodAdjustmentDTO](types.CartTypes.ShippingMethodAdjustmentDTO.mdx)[]&#62;

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&#60;[ShippingMethodAdjustmentDTO](types.CartTypes.ShippingMethodAdjustmentDTO.mdx)&#62;

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&#60;[ShippingMethodAdjustmentDTO](types.CartTypes.ShippingMethodAdjustmentDTO.mdx)[]&#62;

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.

setShippingMethodAdjustments

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.

listLineItemTaxLines

This method retrieves a paginated list of line item tax lines based on optional filters and configuration.

Example

To retrieve a list of line item tax lines using their IDs:

const lineItemTaxLines =
await cartModuleService.listLineItemTaxLines({
id: ["calitxl_123", "calitxl_321"],
})

To specify relations that should be retrieved within the line item tax lines:

const lineItemTaxLines =
await cartModuleService.listLineItemTaxLines(
{
id: ["calitxl_123", "calitxl_321"],
},
{
relations: ["item"],
}
)

By default, only the first 15 records are retrieved. You can control pagination by specifying the skip and take properties of the config parameter:

const lineItemTaxLines =
await cartModuleService.listLineItemTaxLines(
{
id: ["calitxl_123", "calitxl_321"],
},
{
relations: ["item"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved line item tax lines.
The configurations determining how the line item tax line is retrieved. Its properties, such as select or relations, accept the attributes or relations associated with a line item tax line.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<LineItemTaxLineDTO[]>Required
The list of line item tax lines.

addLineItemTaxLines

**addLineItemTaxLines**(taxLines): Promise&#60;[LineItemTaxLineDTO](types.CartTypes.LineItemTaxLineDTO.mdx)[]&#62;

This method creates and adds line item tax lines.

Example

const lineItemTaxLines =
await cartModuleService.addLineItemTaxLines([
{
code: "1000",
rate: 10,
},
{
code: "1234",
rate: 20,
},
])

Parameters

taxLinesCreateLineItemTaxLineDTO[]Required
The line item tax lines to be created.

Returns

PromisePromise<LineItemTaxLineDTO[]>Required
The added line item tax lines.

**addLineItemTaxLines**(taxLine): Promise&#60;[LineItemTaxLineDTO](types.CartTypes.LineItemTaxLineDTO.mdx)&#62;

This method creates and adds a line item tax line.

Example

const lineItemTaxLines =
await cartModuleService.addLineItemTaxLines({
code: "1000",
rate: 10,
})

Parameters

The line item tax line to be created.

Returns

PromisePromise<LineItemTaxLineDTO>Required
The added line item tax line.

**addLineItemTaxLines**(cartId, taxLines, sharedContext?): Promise&#60;[LineItemTaxLineDTO](types.CartTypes.LineItemTaxLineDTO.mdx)[]&#62;

This method creates and adds one or more line item tax lines to a cart.

Example

const lineItemTaxLines =
await cartModuleService.addLineItemTaxLines("cart_123", {
code: "1000",
rate: 10,
})

Parameters

cartIdstringRequired
The cart's ID.
The line item tax lines to add. You can specify one or more items.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<LineItemTaxLineDTO[]>Required
The added line item tax lines.

setLineItemTaxLines

This method sets the line item tax lines in a cart. The existing line item tax lines, except those included in the specified list, are removed and replaced with the specified tax lines.

Example

const lineItemTaxLines =
await cartModuleService.setLineItemTaxLines("cart_123", [
{
code: "1000",
rate: 10,
},
{
code: "1234",
rate: 20,
},
])

Parameters

cartIdstringRequired
The cart's ID.
The line item tax lines to add. If the id field is specified, the tax line is kept 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<LineItemTaxLineDTO[]>Required
The added line item tax lines.

listShippingMethodTaxLines

This method retrieves a paginated list of shipping method tax lines based on optional filters and configuration.

Example

To retrieve a list of shipping method tax lines using their IDs:

const shippingMethodTaxLines =
await cartModuleService.listShippingMethodTaxLines({
id: ["casmtxl_123", "casmtxl_321"],
})

To specify relations that should be retrieved within the shipping method tax lines:

const shippingMethodTaxLines =
await cartModuleService.listShippingMethodTaxLines(
{
id: ["casmtxl_123", "casmtxl_321"],
},
{
relations: ["shipping_method"],
}
)

By default, only the first 15 records are retrieved. You can control pagination by specifying the skip and take properties of the config parameter:

const shippingMethodTaxLines =
await cartModuleService.listShippingMethodTaxLines(
{
id: ["casmtxl_123", "casmtxl_321"],
},
{
relations: ["shipping_method"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved shipping method tax lines.
The configurations determining how the shipping method tax line is retrieved. Its properties, such as select or relations, accept the attributes or relations associated with a shipping method tax line.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ShippingMethodTaxLineDTO[]>Required
The list of shipping method tax lines.

addShippingMethodTaxLines

**addShippingMethodTaxLines**(taxLines): Promise&#60;[ShippingMethodTaxLineDTO](types.CartTypes.ShippingMethodTaxLineDTO.mdx)[]&#62;

This method creates and adds shipping method tax lines.

Example

const shippingMethodTaxLines =
await cartModuleService.addShippingMethodTaxLines([
{
code: "1000",
rate: 10,
},
{
code: "1234",
rate: 20,
},
])

Parameters

The shipping method tax lines to be created.

Returns

PromisePromise<ShippingMethodTaxLineDTO[]>Required
The added shipping method tax lines.

**addShippingMethodTaxLines**(taxLine): Promise&#60;[ShippingMethodTaxLineDTO](types.CartTypes.ShippingMethodTaxLineDTO.mdx)&#62;

This method creates and adds a shipping method tax line.

Example

const shippingMethodTaxLine =
await cartModuleService.addShippingMethodTaxLines({
code: "1000",
rate: 10,
})

Parameters

The shipping method tax line to be created.

Returns

PromisePromise<ShippingMethodTaxLineDTO>Required
The added shipping method tax line.

**addShippingMethodTaxLines**(cartId, taxLines, sharedContext?): Promise&#60;[ShippingMethodTaxLineDTO](types.CartTypes.ShippingMethodTaxLineDTO.mdx)[]&#62;

This method creates and adds one or more shipping method tax lines to a cart.

Example

const shippingMethodTaxLines =
await cartModuleService.addShippingMethodTaxLines(
"cart_123",
[
{
code: "1000",
rate: 10,
},
{
code: "1234",
rate: 20,
},
]
)

Parameters

cartIdstringRequired
The cart's ID.
The shipping item tax lines to add. If the id field is specified, the tax line is kept 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<ShippingMethodTaxLineDTO[]>Required
The added shipping method tax lines.

setShippingMethodTaxLines

This method sets the shipping item tax lines in a cart. The shipping line item tax lines, except those included in the specified list, are removed and replaced with the specified tax lines.

Example

const shippingMethodTaxLines =
await cartModuleService.setShippingMethodTaxLines(
"cart_123",
[
{
code: "1000",
rate: 10,
},
{
code: "1234",
rate: 20,
},
]
)

Parameters

cartIdstringRequired
The cart's ID.
The shipping item tax lines to add. If the id field is specified, the tax line is kept 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<ShippingMethodTaxLineDTO[]>Required
The added shipping method tax lines.

deleteLineItems

**deleteLineItems**(ids, sharedContext?): Promise&#60;void&#62;

This method deletes line items by their IDs.

Example

await cartModuleService.deleteLineItems([
"cali_123",
"cali_321",
])

Parameters

idsstring[]Required
The IDs of the line items.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the line items are deleted successfully.

**deleteLineItems**(id, sharedContext?): Promise&#60;void&#62;

This method deletes a line item by its ID.

Example

await cartModuleService.deleteLineItems("cali_123")

Parameters

idstringRequired
The ID of the line item.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when a line item is deleted successfully.

deleteShippingMethods

**deleteShippingMethods**(ids, sharedContext?): Promise&#60;void&#62;

This method deletes shipping methods by their IDs.

Example

await cartModuleService.deleteShippingMethods([
"casm_123",
"casm_321",
])

Parameters

idsstring[]Required
The IDs of the shipping methods.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the shipping methods are deleted successfully.

**deleteShippingMethods**(id, sharedContext?): Promise&#60;void&#62;

This method deletes a shipping method by its ID.

Example

await cartModuleService.deleteShippingMethods("casm_123")

Parameters

idstringRequired
The ID of the shipping method.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the shipping method is deleted successfully.

deleteLineItemAdjustments

**deleteLineItemAdjustments**(ids, sharedContext?): Promise&#60;void&#62;

This method deletes line item adjustments by their IDs.

Example

await cartModuleService.deleteLineItemAdjustments([
"caliadj_123",
"caliadj_321",
])

Parameters

idsstring[]Required
The IDs of the line item adjustments.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the line item adjustments are deleted successfully.

**deleteLineItemAdjustments**(id, sharedContext?): Promise&#60;void&#62;

This method deletes a line item adjustment by its ID.

Example

await cartModuleService.deleteLineItemAdjustments(
"caliadj_123"
)

Parameters

idstringRequired
The ID of the line item adjustment.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the line item adjustment is deleted successfully.

deleteShippingMethodAdjustments

**deleteShippingMethodAdjustments**(ids, sharedContext?): Promise&#60;void&#62;

This method deletes shipping method adjustments by their IDs.

Example

await cartModuleService.deleteShippingMethodAdjustments([
"casmadj_123",
"casmadj_321",
])

Parameters

idsstring[]Required
The IDs of the shipping method adjustments.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the shipping method adjustments are deleted successfully.

**deleteShippingMethodAdjustments**(id, sharedContext?): Promise&#60;void&#62;

This method deletes a shipping method adjustment by its ID.

Example

await cartModuleService.deleteShippingMethodAdjustments(
"casmadj_123"
)

Parameters

idstringRequired
The ID of the shipping method adjustment.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when shipping method adjustment is deleted successfully.

deleteLineItemTaxLines

**deleteLineItemTaxLines**(ids, sharedContext?): Promise&#60;void&#62;

This method deletes line item tax lines by their IDs.

Example

await cartModuleService.deleteLineItemTaxLines([
"calitxl_123",
"calitxl_321",
])

Parameters

idsstring[]Required
The IDs of the line item tax lines.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the line item tax lines are deleted successfully.

**deleteLineItemTaxLines**(id, sharedContext?): Promise&#60;void&#62;

This method deletes a line item tax line by its ID.

Example

await cartModuleService.deleteLineItemTaxLines("calitxl_123")

Parameters

idstringRequired
The ID of the line item tax line.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the line item tax line is deleted successfully.

deleteShippingMethodTaxLines

**deleteShippingMethodTaxLines**(ids, sharedContext?): Promise&#60;void&#62;

This method deletes shipping method tax lines by their IDs.

Example

await cartModuleService.deleteShippingMethodTaxLines([
"casmtxl_123",
"casmtxl_321",
])

Parameters

idsstring[]Required
The IDs of the shipping method tax lines.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the shipping method tax lines are deleted successfully.

**deleteShippingMethodTaxLines**(id, sharedContext?): Promise&#60;void&#62;

This method deletes a shipping method tax line by its ID.

Example

await cartModuleService.deleteShippingMethodTaxLines(
"casmtxl_123"
)

Parameters

idstringRequired
The ID of the shipping method tax line.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the shipping method tax line is deleted successfully.

softDelete

This method soft deletes carts by their IDs.

Example

await cartModuleService.softDelete(["cart_123", "cart_321"])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

idsstring[]Required
The IDs of the carts.
configSoftDeleteReturn<TReturnableLinkableKeys>
An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<TReturnableLinkableKeys, string[]>>Required
An object that includes the IDs of related records that were also soft deleted, such as the ID of the associated line item. The object's keys are the ID attribute names of the cart entity's relations, such as item_id, and its value is an array of strings, each being the ID of a record associated with the cart through this relation, such as the IDs of associated line item. If there are no related records, the promise resolves to void.

restore

This method restores soft deleted carts by their IDs.

Example

await cartModuleService.restore(["cart_123", "cart_321"])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

idsstring[]Required
The IDs of the carts.
configRestoreReturn<TReturnableLinkableKeys>
Configurations determining which relations to restore along with each of the carts. You can pass to its returnLinkableKeys property any of the cart's relation attribute names, such as items.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<TReturnableLinkableKeys, string[]>>Required
An object that includes the IDs of related records that were restored, such as the ID of associated line item. The object's keys are the ID attribute names of the cart entity's relations, such as item_id, and its value is an array of strings, each being the ID of the record associated with the cart through this relation, such as the IDs of associated line item. If there are no related records restored, the promise resolves to void.

softDeleteAddresses

This method soft deletes addresses by their IDs.

Example

await cartModuleService.softDeleteAddresses([
"caaddr_123",
"caaddr_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

idsstring[]Required
The IDs of the addresses.
configSoftDeleteReturn<TReturnableLinkableKeys>
An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<TReturnableLinkableKeys, string[]>>Required
An object that includes the IDs of related records that were also soft deleted. If there are no related records, the promise resolves to void.

restoreAddresses

This method restores soft deleted addresses by their IDs.

Example

await cartModuleService.restoreAddresses([
"caaddr_123",
"caaddr_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

idsstring[]Required
The IDs of the addresses.
configRestoreReturn<TReturnableLinkableKeys>
Configurations determining which relations to restore along with each of the addresses. You can pass to its returnLinkableKeys property any of the address's relation attribute names.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<TReturnableLinkableKeys, string[]>>Required
An object that includes the IDs of related records that were restored. If there are no related records restored, the promise resolves to void.

softDeleteLineItems

This method soft deletes line items by their IDs.

Example

await cartModuleService.softDeleteLineItems([
"cali_123",
"cali_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

idsstring[]Required
The IDs of the line items.
configSoftDeleteReturn<TReturnableLinkableKeys>
An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<TReturnableLinkableKeys, string[]>>Required
An object that includes the IDs of related records that were also soft deleted, such as the ID of the associated tax lines. The object's keys are the ID attribute names of the line item entity's relations, such as tax_line_id, and its value is an array of strings, each being the ID of a record associated with the line item through this relation, such as the IDs of associated tax lines. If there are no related records, the promise resolves to void.

restoreLineItems

This method restores soft deleted line items by their IDs.

Example

await cartModuleService.restoreLineItems([
"cali_123",
"cali_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

idsstring[]Required
The IDs of the line items.
configRestoreReturn<TReturnableLinkableKeys>
Configurations determining which relations to restore along with each of the line items. You can pass to its returnLinkableKeys property any of the line item's relation attribute names, such as tax_lines.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<TReturnableLinkableKeys, string[]>>Required
An object that includes the IDs of related records that were restored, such as the ID of associated tax line. The object's keys are the ID attribute names of the line item entity's relations, such as tax_line_id, and its value is an array of strings, each being the ID of the record associated with the line item through this relation, such as the IDs of associated tax line. If there are no related records restored, the promise resolves to void.

softDeleteShippingMethods

This method soft deletes shipping methods by their IDs.

Example

await cartModuleService.softDeleteShippingMethods([
"casm_123",
"casm_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

idsstring[]Required
The IDs of the shipping methods.
configSoftDeleteReturn<TReturnableLinkableKeys>
An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<TReturnableLinkableKeys, string[]>>Required
An object that includes the IDs of related records that were also soft deleted, such as the ID of the associated tax lines. The object's keys are the ID attribute names of the shipping method entity's relations, such as tax_line_id, and its value is an array of strings, each being the ID of a record associated with the shipping method through this relation, such as the IDs of associated tax line. If there are no related records, the promise resolves to void.

restoreShippingMethods

This method restores soft deleted shipping methods by their IDs.

Example

await cartModuleService.restoreShippingMethods([
"casm_123",
"casm_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

idsstring[]Required
The IDs of the shipping methods.
configRestoreReturn<TReturnableLinkableKeys>
Configurations determining which relations to restore along with each of the shipping methods. You can pass to its returnLinkableKeys property any of the shipping method's relation attribute names, such as tax_lines.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<TReturnableLinkableKeys, string[]>>Required
An object that includes the IDs of related records that were restored, such as the ID of associated tax lines. The object's keys are the ID attribute names of the shipping method entity's relations, such as tax_line_id, and its value is an array of strings, each being the ID of the record associated with the shipping method through this relation, such as the IDs of associated tax lines. If there are no related records restored, the promise resolves to void.

softDeleteLineItemAdjustments

This method soft deletes line item adjustments by their IDs.

Example

await cartModuleService.softDeleteLineItemAdjustments([
"caliadj_123",
"caliadj_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

idsstring[]Required
The IDs of the line item adjustments.
configSoftDeleteReturn<TReturnableLinkableKeys>
An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<TReturnableLinkableKeys, string[]>>Required
An object that includes the IDs of related records that were also soft deleted. If there are no related records, the promise resolves to void.

restoreLineItemAdjustments

This method restores soft deleted line item adjustments by their IDs.

Example

await cartModuleService.restoreLineItemAdjustments([
"caliadj_123",
"caliadj_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

idsstring[]Required
The IDs of the line item adjustments.
configRestoreReturn<TReturnableLinkableKeys>
Configurations determining which relations to restore along with each of the line item adjustments. You can pass to its returnLinkableKeys property any of the line item adjustment's relation attribute names.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<TReturnableLinkableKeys, string[]>>Required
An object that includes the IDs of related records that were restored. If there are no related records restored, the promise resolves to void.

softDeleteShippingMethodAdjustments

This method soft deletes shipping method adjustments by their IDs.

Example

await cartModuleService.softDeleteShippingMethodAdjustments([
"casmadj_123",
"casmadj_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

idsstring[]Required
The IDs of the shipping method adjustments.
configSoftDeleteReturn<TReturnableLinkableKeys>
An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<TReturnableLinkableKeys, string[]>>Required
An object that includes the IDs of related records that were also soft deleted. If there are no related records, the promise resolves to void.

restoreShippingMethodAdjustments

This method restores soft deleted shipping method adjustments by their IDs.

Example

await cartModuleService.restoreShippingMethodAdjustments([
"casmadj_123",
"casmadj_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

idsstring[]Required
The IDs of the shipping method adjustments.
configRestoreReturn<TReturnableLinkableKeys>
Configurations determining which relations to restore along with each of the shipping method adjustment. You can pass to its returnLinkableKeys property any of the shipping method adjustment's relation attribute names.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<TReturnableLinkableKeys, string[]>>Required
An object that includes the IDs of related records that were restored. If there are no related records restored, the promise resolves to void.

softDeleteLineItemTaxLines

This method soft deletes line item tax lines by their IDs.

Example

await cartModuleService.softDeleteLineItemTaxLines([
"calitxl_123",
"calitxl_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

idsstring[]Required
The IDs of the line item tax lines.
configSoftDeleteReturn<TReturnableLinkableKeys>
An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<TReturnableLinkableKeys, string[]>>Required
An object that includes the IDs of related records that were also soft deleted. If there are no related records, the promise resolves to void.

restoreLineItemTaxLines

This method restores soft deleted line item tax lines by its IDs.

Example

await cartModuleService.restoreLineItemTaxLines([
"calitxl_123",
"calitxl_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

idsstring[]Required
The IDs of the line item tax lines.
configRestoreReturn<TReturnableLinkableKeys>
Configurations determining which relations to restore along with each of the line item tax lines. You can pass to its returnLinkableKeys property any of the line item tax line's relation attribute names.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<TReturnableLinkableKeys, string[]>>Required
An object that includes the IDs of related records that were restored. If there are no related records restored, the promise resolves to void.

softDeleteShippingMethodTaxLines

This method soft deletes shipping method tax lines by their IDs.

Example

await cartModuleService.softDeleteShippingMethodTaxLines([
"casmtxl_123",
"casmtxl_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

idsstring[]Required
The IDs of the shipping method tax lines.
configSoftDeleteReturn<TReturnableLinkableKeys>
An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<TReturnableLinkableKeys, string[]>>Required
An object that includes the IDs of related records that were also soft deleted. If there are no related records, the promise resolves to void.

restoreShippingMethodTaxLines

This method restores soft deleted shipping method tax lines by their IDs.

Example

await cartModuleService.restoreShippingMethodTaxLines([
"casmtxl_123",
"casmtxl_321",
])

Type Parameters

TReturnableLinkableKeysstringRequired

Parameters

idsstring[]Required
The IDs of the shipping method tax lines.
configRestoreReturn<TReturnableLinkableKeys>
Configurations determining which relations to restore along with each of the shipping method tax lines. You can pass to its returnLinkableKeys property any of the shipping method tax line's relation attribute names.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void | Record<TReturnableLinkableKeys, string[]>>Required
An object that includes the IDs of related records that were restored. If there are no related records restored, the promise resolves to void.
Was this section helpful?