Skip to main content

How to identify and load the guest cart items in LWR b2b sites ?

We cannot rely on a common account ID to fetch cart items. This will lead to bad user experience.

Any assistance would be greatly appreciated

#B2B Commerce #LWR
답변 1개
  1. 2024년 9월 22일 오후 6:23

    Hi @Gnanesh Challa,

     

    you can consider using browser-based tracking methods like cookies or local storage. 

     

    1. Generate a unique session ID for each guest user when they first add an item to the cart.

    2. Store the session ID in a cookie or local storage in the user's browser. When the user interacts with the cart, use this session ID to retrieve the cart items from your backend, ensuring each guest has a unique experience.

    3. Ensure the session persists until the cart is checked out or abandoned. This way, the experience remains consistent without relying on a common account ID. If the user later registers or logs in, you can link this guest session to their newly created account.

     

    Make sure to handle session expiry and data privacy properly to avoid potential issues. This method should help with your task.

0/9000