Closed haszari closed 3 years ago
@haszari The cookie wp_woocommerce_session
is not set by the PayPal Checkout plugin. It's set by WooCommerce for logged-in users and contains a unique code for each customer so that it knows where to find the cart data in the database for each customer. More about WooCommerce cookies here - https://docs.woocommerce.com/document/woocommerce-cookies/
Most managed hosting services exclude this cookie to prevent problems with WooCommerce Cart / Checkout functionality. I would suggest not to cache the WooCommerce cookies since it might break the users site.
Seeing the same issue - session cookie is immediately set even without interaction with the cart and not being logged in as a user. Disable the plugin and the issue goes away.
@tullibo Thanks for the report. Can confirm this behavior. The cookie is added by PPEC to if PayPal is enabled on Single Product pages. By default WooCommerce doesn't set this cookie unless a product is added to cart, however for direct purchases from single product pages to work, the cookie should be set.
Here is the reference to the cookie code - https://github.com/woocommerce/woocommerce-gateway-paypal-express-checkout/blob/fb334293bbe0e822cf9fbeccd19e737253c1ece0/includes/class-wc-gateway-ppec-cart-handler.php#L593
We'll try to modify this behavior and limit the cookie creation on WooCommerce pages only instead of all pages
@haszari Sorry! I missed this when you reported the issue.
I think https://github.com/woocommerce/woocommerce-gateway-paypal-express-checkout/pull/793 should solve the issue nicely. It's not perfect because product pages won't cache, but it should be a big improvement over the current situation.
Describe the bug
When
PayPal Checkout
gateway is enabled, there's asession
cookie on all pages. This can interfere with caching and slow down sites. If the gateway is disabled, the session cookie is not present.This was reported by a customer in 3077952-zen
Is this expected behaviour?
Apologies if this is the wrong PayPal Checkout plugin – I see there are a few :)
To reproduce
I reproduced this on a test site.
WooCommerce > Settings > Payments
and enablePayPal Checkout
gateway.Example:
Expected behavior
Session cookies on eComm/user-related pages, e.g. cart, checkout, my account, and no session cookie otherwise.
Environment (please complete the following information):