Strange session issue with Woocommerce - wordpress

I'm trying to get WooCommerce up and running on a basic site, and I'm having a problem with the cart.
Basically, when I'm logged in as admin, everything works as expected. But when I'm not logged in, I can add an item to the cart, but the cookies immediately disappear, thereby stopping the cart from working at all... It seems like the session is being reset by either WooCommerce or Wordpress every time a WooCommerce page is visited by a guest.
This is a big problem, as I don't want anyone to be signing up for accounts to buy my single product.
Does anyone know what could be causing this, and how to fix it? I've looked through the WooCommerce code, and I can't see anything but the init method of the $woocommerce global calling the methods that set the cookies... And the cookies themselves are set to be deleted when the browser closes, but they are being overwritten as soon as the cart page loads.

I just ended up installing JigoShop. Needed some CSS tweaks to work with TwentyTwelve, but it allows people to buy stuff, which is more than WooCommerce has done for me ;)

We had the same problem on https://sherpax.cz ecommerce store. Go to plugins, and remove all caching plugins (Comet cache, etc.). There was an issue with session mixing even if Comet cache was set up properly not to cache particular pages (cart, etc.).

Related

How to Prevent Cart from clearing on registration in Woocommerce?

If a user adds a product to card, then goes to account page and registers a new account, the product(s) in the cart are automatically removed. How to prevent this behavior?
Try following these debugging steps:
https://businessbloomer.com/woocommerce-solving-cart-empty-issue/
Fix 1. Make sure there is no “red alert” under WooCommerce / System Status
Fix 2. Click the following buttons under WooCommerce / System Status / Tools
Fix 3. Check your Theme, WooCommerce & WordPress are using updated, compatible versions
Some premium themes won’t notify you if there is an update available. You have to make sure you’re using the latest, Woo-compatible version. Check with your theme vendor, plugin developers and see if anything has been reported.
For example, you might have updated WooCommerce too soon – sometimes premium plugins/themes require a few days/weeks before they can adapt to the new changes (if major) and become 100% compatible.
Fix 4. Save (flush) your permalinks
Go to WordPress/Settings/Permalinks and click on “save”. This should flush the permalinks and give you a chance to test the cart again.
Fix 5. Check you have no spaces in your checkout end-points
Go to WooCommerce/Settings/Checkout and make sure you have no spaces in your end-points. This happened to a client a while ago and it too me ages to find out (who would think the permalinks had been changed?):
WooCommerce Checkout Endpoints
Fix 6. Properly set up your WordPress cache plugin
Cart and Checkout pages should not be cached – if your WordPress cache plugin is for some reason caching WooCommerce pages, your cart will probably show as empty. Make sure to select a WooCommerce-compatible cache plugin 🙂
Also: ask your hosting to disable or properly set up server cache
Some hosts have their own cache system and this is sometimes applied to your website by default. Create a ticket or give them a quick call to find out if they have anything like that and if they can disable that as soon as possible.
For example: WPEngine uses its own cache. This might affect your WooCommerce Cart. Please contact support so they can create a caching exception list for WooCommerce and/or ajax files
Fix 7. Disable all plugins but WooCommerce
This is a typical troubleshooting operation. Disable all plugins and see if the Cart is back functioning. If YES, reactivate one plugin at a time and test the Cart again. As soon as you find the “guilty” plugin – yay! – time to substitute that plugin or see if there is an update available!
Fix 8. Try switching to a default WordPress Theme (e.g. TwentySixteen)
This is to prove the error is not theme-related. You won’t lose any content if you switch between themes, so don’t worry. If the error goes away, then check with your theme developers and report the bug 🙂

Woocommerce - Billing / shipping address doesn't update in My Account

I'm facing a little weird problem: when I change the billing or shipping address inside My Account screen, the address seems to have changed, however after refresh the page, the old address remains there and I look at the admin and check that anything was changed.
Have you ever seen that issue before? My theme still uses Woocommerce 1.6.4 because we're working on a new theme development and we can't update WC yet.
Any helps?
This has happened to me before. The problem was the WP Super Cache Plugin. The document below on the Woocommerce website explains why this happens. The cart, my account, and checkout page need to stay dynamic since they display information specific to the current customer.
https://docs.woothemes.com/document/configuring-caching-plugins/
If you aren't using a caching plugin, try clearing out your browser cache. If that doesn't fix the issue, I would revert back to the basics. Updating Woocommerce would be highly recommended, but in your case, I would disable any new plugins you have added. Since you are using an old version of Woocommerce, any new plugins added could be creating a conflict. I hope that helps!

woocommerce cart is empty after adding products

I use woocommerce on wordpress. But have one problem with checkout page. I'm adding products to the cart, then it redirects to cart page(as I checked this option from Woocommerce Settings-> "Redirect to the cart page after successful addition"), in the cart page I have "Update Cart" and "Proceed to checkout" buttons, after clicking on both buttons I'm redirected to Empty Cart page.
I noticed a thing that cart is updated after some minutes and after that it works. What can cause this maybe cookie or session issue?
The most simple solution:
Go to settings, change from "https" to "http", try it now, if it works there is a issue with woocommerce forcing autentication, you can simply leave it be, and use "Wp Force SSL" to keep runing the SSL certification and have no more problems with it.
Worked for me
I ran into this problem and tried a bunch of things:
- installing a session plugin
- updating woocommerce & theme
- updating wordpress
- updating my plesk server
- adding session.autostart = 0 in PHP.ini
- using expiresActive Off in .htaccess
- removing AJAX on products and REST API in woocommerce settings
- refreshing status in woocommerce system status
The one thing that finally worked for me (i think) was installing WP Force SSL
this sounds like an ad. I hope this helps!
I did debug it and the issue was
woocommerce_sessions: Table does not exist
Deactivate and reactive the plugin, so that woocommerce plugin create a session table again.
You are 18 versions behind. https://wordpress.org/plugins/woocommerce/changelog/
Your WordPress version is also behind.
You should update both of them before continuing to try and figure out the problem.
As you can see by the change log link I posted there are a ton of fixes you are missing by not being updated.
check the tick mark for Force secure checkout on woocommerce >> setting >> checkout.
If you have https secure certificate it should ticked (marked).
For some reason, sometimes you add products to cart but the cart page stays empty (even if you can clearly see the cart widget has products). But don’t worry – it might just be a simple cache issue (and if you don’t know what cache is that’s no problem either).
Please follow this link for full detail: https://businessbloomer.com/woocommerce-solving-cart-empty-issue/

How to make changes are not visible in userside using wordpress

I want to edit contents of the existing page in wordpress.It is a live site so user side should not be changed
untill i want to publish that after all changes made to that page.Is there any plugin or what
i have to do for this.
Anyone please help me.
It depends what sort of changes. As noted above if you're channing post contents if will be enough not to publish them, but I guess you already now that.
However if you want to change appearance of the site then caching plugin might help. E.g. with w3 total cache you can do any change to template/css/php and so on and only logged in users will see changes (any non logged in user will get cached version of the page until you clean cache or cache expires).
If you have also users which are logging in into your wordpress, then I'm not aware of already made plugin that have such functionality - you probably would have to create development version of your site and test changes there.
For content - agree with previous answers.
But if you are changing the theme and want some changes to be visible only for you (admin) then you can use is_admin() function to print out different content for admin (new one) and different for other users (old one).
http://codex.wordpress.org/Function_Reference/is_admin

WooCommerce Does Not Allow Adding Products To Cart Unless Logged In

This problem occurred recently - if I am not logged into Wordpress, I am not able to add products to my WooCommerce cart. It redirects to the cart page as it should but shows 'Cart Empty'. Works perfectly when I am logged in as a user in any role. I searched around and found this thread: http://wordpress.org/support/topic/plugin-woocommerce-cart-brokennot-adding-products
I've tried changing my session folder with a custom php.ini file but the problem is still persisting. I used Duplicator and set up an instance on my localhost - where it works without issues, so that tells me the problem isn't with the theme or the plugins. What other issues with hosting could be causing this?
For me the error was caused by Rackspace's "Varnish" script. it's a server-side caching tool that they use. I don't have more details than than. but once I alerted Rackspace, they fixed it pretty fast.

Resources