Javascript cookie values not being stored in single session -
i have shop page uses javascript cookie store contents of visitor's shopping cart.
the cookie stored so:
document.cookie=products[x].id + "=" + products[x].qty;
and values stored correctly product code , quantity.
name value -----------|-------- product1 | 0 product2 | 1 product3 | 2
however, once visitor has checked out , completed shopping flow, there confirmation page resets values of cart:
for (x in products) document.cookie=products[x].id + "=" + 0;
the values in cookie 0 expected. problem occurs when navigating shop page cookie has inital values , cart not empty.
what going wrong?
i guess not overwriting original cookie creating new one. have in exact same domain (www.greener.xyz / shop.greener.xyz). must have same protocol (http / https).
Comments
Post a Comment