You have no items in your shopping cart. error using Magento 2

You have no items in your shopping cart. error using Magento 2

September 25, 2026 · Illustrated author avatarBy Stefan Bogdanescu
You have no items in your shopping cart. error using Magento 2

Magento 2: Troubleshooting “You Have No Items in Your Shopping Cart” Error

If you’re experiencing the dreaded “You have no items in your shopping cart” message while using Magento 2, even after adding products to your cart, you’ve come to the right place. In this post, we’ll dive into the most common reasons for this issue and provide practical solutions.

Understanding the Problem

The error typically arises due to miscommunication between the client-side and server-side data or problems with the session management system in Magento 2. Let’s explore two primary culprits behind this frustrating issue.

One of the most common causes is incorrect cookie configuration, especially when dealing with multiple stores or websites within a single Magento installation.

Symptoms

  • The cart shows an empty message even after adding products.
  • Switching between stores clears the cart data.

Resolution

Ensure your cookies are configured correctly for each store:

  1. Navigate to Stores > Configuration > General > Web.
  2. In ‘Unsecure’ and ‘Secure’ sections, check if the cookie domain is set properly. For subdirectories like www.example.com, the domain should be example.com.
  3. Click ‘Save Config’ after making changes.

Issue #2: Session Management

Incorrect session management can also lead to cart emptiness. Magento 2 uses PHP sessions by default, which require careful handling.

Symptoms

  • The cart behaves erratically across different pages.
  • Clearing cookies or refreshing the page empties the cart.

Resolution

Ensure your server is configured correctly for PHP sessions:

  1. Check if your php.ini file has appropriate settings for session duration and cookie parameters. You mentioned a cookie limit of 86400 seconds, which seems correct.
  2. Verify that session data is being saved to the correct directory on your server by checking the ‘session.save_path’ directive in php.ini.
  3. In Magento’s configuration, set ‘Session Storage’ to ‘File system’ if you’re not using a shared hosting environment.

Advanced Troubleshooting

If the above steps don’t resolve the issue, consider these advanced techniques:

  1. Flush Magento Cache: Go to Stores > Settings > All Stores > Scope (Change scope if necessary) > Configuration > Advanced > System > Cache Management.

    • Select all cache types and click ‘Flush Magento Cache’.
  2. Check JavaScript Errors: Open your browser’s developer tools and go to the ‘Console’ tab. Look for any errors that might be preventing the cart from updating.

  3. Review Third-Party Extensions: If you’re using any third-party extensions, disable them temporarily to rule out conflicts.

Conclusion

The “You have no items in your shopping cart” error in Magento 2 can be a headache, but with the right troubleshooting approach, you should be able to resolve it. Remember, the key lies in ensuring your cookie configuration and session management are optimized for your specific setup.

If you’re still facing issues or require more advanced assistance, don’t hesitate to reach out to our professional Magento development team.

Happy debugging!

Magento 2 Checkout Catalog Configuration

Our network