To understand the concept of persistent shopping cart, take an instance of the sales process on your ecommerce store. Your customer has added items to her shopping cart and has proceeded to check out. But something goes wrong during the checkout process. Now if that customer doesn’t have a pressing need to buy your products, she is not repeating the whole process. You’ve just lost a sale!
Magento 2 comes with a functionality where you can be persistent with your sales. When your customer comes back to your website, they’ll find that the items she previously added to cart are still there. Magento will persist with the cart items irrespective of which device your customer is using to log back into their account.
In this tutorial, you’ll learn how to set up persistent shopping cart in Magento 2.
Enabling Persistent Shopping Cart
Persistent shopping cart is disabled by default in Magento 2. To enable persistence, follow these steps.
Step 1: Go to Stores => Configuration (under Settings)
Step 2: Expand the Customers section from the left sidebar and click on Persistent Shopping Cart.
Step 3: Uncheck the Use system value box and set Enable Persistence to “Yes”. More fields will appear as below.
Step 4: Uncheck the Use system value box for all settings and configure the following settings:
- Persistence Lifetime (seconds): Persistence is enabled by using cookies to store the customer data. Set this field to how long you want that cookie to be stored. The default setting is a duration of one year (31536000 seconds).
- Enable “Remember Me”: Set this to “Yes” if you want the “Remember Me” checkbox to appear on the login page.
- “Remember Me” Default Value: If you choose the “Remember Me” checkbox to appear, you’ll need to tell Magento whether to keep the box checked or unchecked on page load by default. Set this to “Yes” to keep the “Remember Me” box checked on the login page.
- Clear Persistence on Sign Out: Set this to “No” if you want to keep the items in your customer’s cart even after they log out. Set this option to “Yes” if you want to clear the cart after your customer logs out.
- Persist Shopping Cart: Set this to “Yes” if you want to keep the persistent cookie even after the session cookie expires. What this means is even after a customer’s session ends, Magento keeps your customer’s items in their shopping cart. This is great for persisting with the items in the cart for guest users.
Step 5: Click on Save Config button to enable persistence.
You’ll be prompted to manage cache through a system pop-up message.
Use steps in this tutorial to flush the cache.
Persistent cart is now enabled on your Magento 2 ecommerce store.
This concludes our tutorial on how to set up persistent shopping cart in Magento 2.