By default, EDD chooses PHP sessions as they are typically more performance friendly than database driven session handling, and help avoid issues with some object caching plugins and their shortcomings with the transient option types.
In some cases, servers / hosting may not support PHP sessions, which can cause EDD to not function properly. If that’s the case, you’ll need to override the default by setting EDD PHP Sessions to false. All this does is tell EDD to use a different method to keep track of a user on the site.
The checkout page reporting Empty Cart when an item should be added is a common symptom of PHP sessions not supported by the server. Please review Shopping Cart Is Empty at Checkout prior to disabling sessions as there are other reasons this could be happening.
If you need to change this default:
Place this constant in your wp-config.php file to disable EDD PHP Sessions:
define( 'EDD_USE_PHP_SESSIONS', false );
If you need to re-enable EDD PHP Sessions, either delete the line above or set it to
define( 'EDD_USE_PHP_SESSIONS', true );
If you are unsure of how to edit your wp-config.php file, please consult the official WordPress help page on editing the file.
Note: you must place this code above the line that says:
/* That's all, stop editing! Happy blogging. */
It is safe to leave the constant in wp-config.php indefinitely.
How do EDD PHP Sessions work?
If this constant is defined, Easy Digital Downloads will use PHP $_SESSION for storing cart data. By default, when the EDD_USE_PHP_SESSIONS constant is not defined, EDD will look to see if the server supports PHP based sessions and choose PHP session handling going forward. If the session_start function is not supported, then EDD falls back to the WP_Session class, which is a combination of browser cookies and database rows stored in the wp_options table.