Best practice to hanle cart references



Can you please confirm that the below basic flow is ok to handle the cart reference id on client side?

  • when user logging in (or starts adding first product to cart) I generate a uuid on client side and I store it in a cookie
  • I create a cart with this uuid (via the carts/{uuid}) endpoint or with the Moltin.Cart({uuid}) JS method
  • I use this cart until the user is logged in and I delete the cart on logout with the Moltin.Cart({uuid}).Delete() (or I keep it, depends…)
  • how will the unused carts be purged on backend side if I do not handle the deletion?

Thanks in advance:


Hey Greg,

That all sounds right to me. On the Moltin end they keep track of your cart for 7 days.



This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.