Delete From Basket

The delete from basket API deletes a root product, child product, or a promotion from the basket. The root product deletion could either be through a bundle number or by passing the bundle context key in the input with action as deleteFrom basket.

The core services include the version information in their key computation. The system gets the basket from the cartContextKey passed in the input, removes the bundle corresponding to the bundle number, and computes the cache key. If the cache is found against that key, it is returned. If it is not found, then order line items are created by cloning the bundles from the existing basket and running validation and pricing with today’s reference dates. The response is cached with the effectivity as a subset of the timeslices of the offer bundles present in the basket.

Delete from Basket - Delete by Bundle Number

The other variation of delete product from the basket takes the bundle context and line item key in the input body. The request parameters can be found in the deleteFrombasket action on the line item. If the bundle context key and line item key are the same, then the root product is deleted. If the bundle context key and line item key are different, then the child product is deleted.

With versioning enabled, the core flow of delete product remains the same. The underlying services of the cart context key computation and validations take the version information and reference dates of the root product addition. Basket creation includes validation, pricing, and caching services. The new basket, after removing the child product, is cached with the same effectivity as that of the existing basket. However, if the action was removal of the root product, then the cache effectivity is recalculated and the basket is cached with the new cache effectivity dates.

Delete From Basket - Delete Product

This Delete Promotion API deletes the promotion in the bundle. The API operates in two modes when the delete services function is enabled. The promotional products are also deleted along with the promotion. If the delete service custom setting is false, only the promotion is removed.

Validation, pricing, response generation, and caching services include:

  • Versioning information.

  • Caching of the response with recomputed time slices effectivity.

  • Additional fields in the basket response.

  • Caching the basket creation.

  • Root item addition dates.

  • Passing of the reference dates in the pricing and validation services.

Delete From Basket - Delete Promotion

The Update Existing Basket API is a PUT operation and is used to update the product in an existing basket. The API can be used to update the quantity, attributes values, or other custom fields of a product.

While validating the basket, the offer’s version is validated. Other processes, such as generating keys, pricing, and validating the updated basket consider the version information. In case of a cache miss, while storing the details in the cache, the cache effectivity dates will depend on the product type being updated. The cache effectivity dates of the old basket are used.

Delete From Basket - Update Product