Use the example SDK code in this topic to addToBasket with basketAction=DeleteFromBasket. The call must have deleteBundleNumber as an input parameter.
// Instantiate the input object for the addToBasket method to specify parameters.
const input = digitalCommerce.createAddToBasketInput();
// Use your AWS gateway.
input.anonymousSiteUrl = "https://mubnr8cjgl.execute-api.us-west-2.amazonaws.com/prod/dc";
// Use your Catalog Code.
input.catalogCode = "Mobiles";
// Delete an offer that was added to basket.
input.basketAction = "DeleteFromBasket";
input.forceInvalidateCache = true;
// The basket item list grows from the bottom up. For example: if you add products A, B, and C in that order,
// the JSONResult.records list would be C,B,A with respective numbering as 0,1,2.
// The 0 item will always be the most recent addition.
input.deleteBundleNumber = 0;
// Invoke the Basket API via the addToBasket() method.
digitalCommerce
.addToBasket(input)
.then(response => {
Logger.info(
"Vlocity digital commerce addToBasket with basketAction=DeleteFromBasket for anonymous user: " +
JSON.stringify(response)
);
})
.catch(error => {
Logger.info(
"addToBasket with basketAction=DeleteFromBasket for anonymous user rest call failed" +
error
);
});
Possible error conditions:
"AddToBasketInput::getAPIPath() must have catalogCode."
"AddToBasketInput::getAnonymousRestUrl() must have anonymousSiteUrl."
"AddToBasketInput::getAnonymousSiteRestUrl() must have catalogCode."
"AddToBasketInput::getPostBody() must have basketAction."
"AddToBasketInput::getPostBody() must have deleteBundleNumber when basketAction is 'DeleteFromBasket'."