Broadleaf Microservices
  • v1.0.0-latest-prod

Promotions

The following operations allow you to add and remove offer codes on a cart.

Add an offer code to a cart

Operation

CartClient#addOfferCodeToCart(cartId, offerCode, options);

Parameters

Parameter Type Required? Description

cartId

string

The id of the cart.

offerCode

string

The offer code to add to the cart.

options

PriceableCartClientCallOptions

Options passed to the HTTP request call to customize the request configuration.

Response

This function returns a AddCodeToCartResponse.

Example

Example of adding an offer code to a cart
const response = await cartClient.addOfferCodeToCart('CART_ID', 'OFFER_CODE', { accessToken });

console.log(response.cart);

Remove an offer code from a cart

Operation

CartClient#removeOfferCodeFromCart(cartId, offerCode, options);

Parameters

Parameter Type Required? Description

cartId

string

The id of the cart.

offerCode

string

The offer code to remove from the cart.

options

PriceableCartClientCallOptions

Options passed to the HTTP request call to customize the request configuration.

Response

This function returns a Cart.

Example

Example of removing an offer code from a cart
const cart = await cartClient.removeOfferCodeFromCart('CART_ID', 'OFFER_CODE', { accessToken });

console.log(cart);