A shopping cart plugin or a membership plugin will exhibit strange behavior if PHP session on your server is not working correctly. It is your hosting provider's duty to give you a correctly setup server where PHP session is working properly. Sometimes the session problem can come from a bad plugin that you may have installed on your site.
This post will help you pinpoint the source of the PHP session related issue (if you have one) so you can address it.
How To Find Out If You Are Having a PHP Session Related Issue
This simple test should help you identify if you are having PHP Session issue on your server.
Step 0: Make sure to empty the cache and deactivate any caching plugin before you do this test.
Step 1: Add a product to the shopping cart (Check to make sure that the item is in the cart)
Step 2: Now browse to a different page on your site (any page will do).
Step 3: Go back to the page where you have your shopping cart that shows you the items in your cart. Can you see still the item that you added in step 1?
If you can see the item in the cart after step 3 then your PHP Session is most likely working fine.
If you cannot see the item the cart after step 3 then that means your PHP Session is not storing the data like it is supposed to. The PHP session is losing the value when you do another operation (step 2 in this case).
How to Solve The Issue
Once you identify that your site is showing the above mentioned behavior, you need to find out the source. The following checklist should help with that:
Turn off any caching plugin (if you have one) while you do the following checks.
1. Issue related to PHP session setup
Occasionally a server may not have it's PHP session configured correctly. Please note that you won't be able to use a shopping cart software without the PHP session working correctly. It is your hosting provider's responsibility to give you a server where the PHP session is setup properly. Contacting your hosting provider and requesting them to fix it is a good idea.
Making the PHP session to work is not very hard. You mainly have to make sure the following two things are in place:
1) Check if your server's PHP config is set to allow sessions.
2) Check to make sure the session save path has been configured correctly. This is just a matter of adding a line similar to the following in the php.ini file:
session.save_path = /tmp
It is best to contact your hosting provider so they can do this for you. All you have to do is request them to fix the PHP session issue on your server and they should know what to do.
2. Issue related to using a bad plugin that is messing up the PHP session
There are a few plugins out there that are not coded correctly and messes up the PHP session on your site when they are installed. I have seen a few plugins that creates a new PHP session without checking for an existing one first which can cause this issue. Do the following test to identify if you have a bad plugin like this so you can delete that plugin:
3. Issue related to incorrect server setup
Please check this article that explains how this issue can come from incorrect server setup (check the 2nd point):
The following topics are good examples of how other users (who faced this issue) fixed the issue: