Remove Loyalty Reward

removeLoyaltyReward is used to remove a loyalty reward from the cart.

Usage

removeLoyaltyReward takes in the following object:

interface RemoveLoyaltyRewardRequest {
    orderId?: string;
    rewardId?: string;
}
  • orderId is the ID of the order to remove the reward from (same as cart ID). Uses the current order if not supplied.
  • rewardId is the ID of the loyalty reward to be removed. If not provided, the first reward in the cart will be removed (stacking rewards is not currently supported so there should only ever be at most one reward in the cart).

Note: You must still pass in an empty object if you choose not to set any properties.

Examples

// With a reward ID 
const removeLoyaltyRewardRequest = {
    rewardId: "11ef116173e1369d8c6b089e019fd17a",
    orderId: "11ef1d135548d3a88c6b089e019fd17a"
}
// Without a reward ID
const removeLoyaltyRewardRequest = {
    orderId: "11ef1d135548d3a88c6b089e019fd17a"
};
// Using the 'removeLoyaltyReward' function
try {
    const response = await sdk.cart.removeLoyaltyReward(removeLoyaltyRewardRequest);
} catch (error) {
    // Handle errors
}

Return Value and Error Handling

removeLoyaltyReward has the same return value and error handling that is documented for addItem.