Friday, October 3, 2014

Managing cart with cookies

Cookies play very important role in e-commerce application. Here I am talking about managing cart with cookies. Its very interesting and need to understand better its limitation and challegnes.

I feel that cookie can be used for sharing cart as well managing cart in multiple JVMs.
If DB is same for the application then its easy to offer cart by loading order from DB. The challenge start if DB is not shared and multiple application wanted to share cart during checkout flow.

First we need to create cookie with all required attributes like: sku_id, product_id, promo_id, catalog_id etc... After all values are set, need to encrypt the data, set expiry time before adding to browser cookie.

This cookie can be read in application to load commerce item. It can be used load order, merge order with existing order and even persist order to DB by decrypting the cookie data.

We have to make sure cookies are secure.

No comments:

Post a Comment