Shopping Cart Is Empty at Checkout
Easy Digital Downloads has a native shopping cart system that allows store visitors to add multiple items to their shopping carts before checking out. However, there are a number of host, site, and browser configurations that can break this functionality and cause the cart to appear empty at checkout.
Below is a list known reasons why your shopping cart may appear empty at checkout and what you can do about it.
Caching plugins are the most common culprit because they are so widely used. Their purpose is simple - caching plugins speed up load times for your website by storing certain website data for easy access when requested by the browser. While this is a great way to make your site fast and reduce server traffic, it must be used carefully.
Your site's checkout page should not be cached. Why? Because the information on that page needs to change frequently. Adding items to the cart, removing them, calculating cart totals, and all other functions of the checkout page need to reflect the actual state of the page data every time it is loaded. Otherwise, you can (and most likely will) receive unexpected results when it's time to checkout.
If you are using a plugin such as W3 Total Cache, WP Super Cache, or another similar plugin, you must configure it to avoid caching on the checkout page.
If you are using Varnish as a caching layer, you may want to read this document on configuring Varnish for use with Easy Digital Downloads.
Web Host Caching
Though less common, server-side caching can be just as big of a problem for your shopping cart system. Many web hosts offer caching services that you opt into and configure yourself. Others, such as WP Engine, practice aggressive caching whether you ask for it or not.
If you are not using caching plugins and you are still experiencing issues at checkout, contact your host to see if there's caching in place. If so, you will need to request a cache exception for your checkout page.
iPage: If you are hosting your site with iPage, you will need to use a version of PHP lower than 7.0.x. There is a configuration issue with versions of PHP 7 that causes empty carts to occur, however using the newest version of PHP 5 allows the site to function normally.
Blocked admin-ajax.php File
Included in WordPress core is a file called
admin-ajax.php which is used heavily in the shopping cart system, the processing of discounts, and many other important parts of EDD's functionality. Blocking access to this file can cause issues with your cart behavior.
If you are using any security plugins or have aggressive security settings on your server, temporarily disable them and check the cart functionality again. If your security settings block this file, your cart will not work properly.
For more information on blocked admin-ajax.php, see the full documentation.
There are plugins that block access to /wp-admin/ for security purposes, and these sometimes also block admin-ajax.php, causing the problems listed above.
To test to see if this is the issue, temporarily deactivate admin blocking plugins. If the problem is resolved then you know it was that plugin.
No PHP Session Support
PHP sessions are designed to give your site visitors a more customized experience. The ability to add items to a shopping cart from page to the next, and then see all of store items in the cart at checkout is about as personal as it gets for a brand new visitor that hasn't shared any information with your site.
However, your web host needs to support PHP sessions in order for your EDD system to use it. Lack of sessions support is oftentimes the reason for an empty cart. If the above issues do not apply to you, try adding the following to your `wp-config.php` file (in the root of your WordPress install):
define( 'EDD_USE_PHP_SESSIONS', false );
Place this code directly above the
/* That's all, stop editing! Happy blogging. */ line. It will not work if you place it at the bottom of the file.
That will instruct EDD to use an alternate browser session tracking system that is supported by your host.
Browser cookies disabled
In order for WordPress to keep track of the contents of the cart your domain name needs to remain consistent throughout your site. If your Settings say your site is http:// www.example.com, but you have links to http://example.com then your browser sees those as two different sites.
Make sure that whatever you have set under Settings → General is used in all links throughout your site.
In some cases, we have seen where a 3rd party plugin or script installed modifies the Site Address or WordPress address automatically after a certain amount of time. Double check that your Site Address is not being modified to have the www removed or added automatically.
The .htaccess file is used by the server to properly route user requests to your pages. WordPress has a set of default rules that we rely on in order for the cart to properly work. If you are having problems with your cart being empty, try and use the default .htaccess configuration set by WordPress: https://codex.wordpress.org/htaccess
Known Plugin Conflicts
- YouTube SimpleGallery
- Web Ninja Auto Tagging System
- Easy Bootstrap Shortcode