I also did a fresh installation of wordpress and woocommerce to see if my problem persisted and it didn’t. I set up wordpress/woo in a sub folder with a new database using the 2015 theme so I could test a dummy product, the add to cart function worked properly.
So I can rule out hosting issues and can only assume I have an issue with my database? anyone have a remedy for an issue like this?
This can sometimes be an issue with session.save_path not being set in your php.ini file. Since the new installation works, that may not be the case. But its worth taking a look.
Thanks for the suggestion Mike, I didn’t expect php.ini to be the issue as the dummy site worked fine. I tried it anyway, set up a new folder in the root with correct ownership and permissions and changed the session path to that location. Alas, nothing changed.
At this point I’m suspecting commentmeta table data may be the source of my issue. woocommerce uses that table and Im suspecting it may use it for session data. That table was severely bloated so I recently cleaned it out and optimised it. It’s the only remaining component that I think may be the cause for this issue. I am happy to take suggestions if anyone has any.
I just removed all products from my test server and truncated the commentmeta table. I then set up some simple products and found that I am able to add simple products from the /shop or /shop/category pages but am still not able to add to cart from the product single page.
I got the same results when I tested the above on the 2015 and 2013 themes with all plugins but woo disabled. Now I’m really confused as my problem suggests a possible jquery or js conflict, but I have no console errors and you would think switching themes would also rule that out. Again, I’m open to any suggestions.
Plugin Contributor
royho
(@royho)
From my testing on your site, so far I was able to add variable items to the cart as seen here http://cld.wthms.co/15xs3/1nrMmAMB and I was able to proceed to checkout thereafter.
I finally found the source of the issue and have since fixed the problem. I was on my way home from work when you replied royho.
After all my that above /\ the problem ended up being related to cookie data, more specifically it was a .htaccess problem. I recently replaced wordpress and moved it into a subfolder so I could seperate all the residual crap that sitting in the root. As it was a fresh install and not a migration I didn’t realise there was an additional .htaccess file in the subfolder (stupid me). So woocommerce has been writing cookies under the rewrite conditions set in the subfolder .htaccess file but the browser was trying to read cookies relative to the root .htaccess file.
Once I realised that after 2 full days of troubleshooting, it was a 30 second fix. Hopefully my mistake and troubleshooting will help someone else save 2 days of their life haha. But hey, I learnt a lot so I’m taking that as a positive.
Plugin Contributor
royho
(@royho)
@lucidlips – no worries, thanks for replying back and just glad everything is working for you now.
I’m glad too haha, thanks for going to the effort of checking it out, much appreciated @royho.