Skip to main content
Skip to main content

computeActions - Promotion Module Reference

This documentation provides a reference to the computeActions method. This belongs to the Promotion Module.

This method provides the actions to perform on a cart based on the specified promotions and context.

Example

const actions = await promotionModuleService.computeActions(
["50OFF"],
{
items: [
{
id: "cali_123",
quantity: 2,
subtotal: 1000,
},
],
shipping_methods: [
{
id: "casm_123",
subtotal: 0,
adjustments: [
{
id: "adj_123",
code: "FREESHIPPING",
},
],
},
],
}
)

Parameters

promotionCodesToApplystring[]Required
The promotion codes to be applied on the cart.
applicationContextComputeActionContextRequired
The items and shipping methods of the cart.
optionsRecord<string, any>
Any relevant options that may change how the actions are computed.

Returns

PromisePromise<ComputeActions[]>Required
The list of computed actions to be applied on the cart.
Was this section helpful?