Add to cart does nto work for anonymous users in WooCommerce

I have a couple of Wordpress sites on bedrock with WooCommerce and adding to cart does not work with anonymous users. I’ve tried disabling all other plugins and switching to a core theme, among other things but nothing works. It works in my local environment so I think it’s something to do with the Platform.sh environment. One site uses Redis and one does not so that doesn’t seem to be the issue either. Any ideas?

0

Comments

1 comment
Date Votes
  • in case someone is looking for a solution : routes.yaml with cache enabled needs to set woocommerce cookie in order avoid cart caching which is the issue ( guests adding product to cart not being able to check for their cart because no session is available because psh is serving cache because WC cookies are not taking in account in cache rules – yeah i know that s a lot to take )

    You re welcome

    example : 

     

    "https://{default}/":
        type: upstream
        upstream: "app:http"
        cache:
            enabled: true
            # Base the cache on the session cookies. Ignore all other cookies.
            cookies:
                - '/^wordpress_logged_in_/'
                - '/^wordpress_sec_/'
                - 'wordpress_test_cookie'
                - '/^wp-settings-/'
                - '/^wp-postpass/'
                - '/^wp-resetpass-/'
                - '/^wp_woocommerce_session_/'
                - '/^woocommerce_items_in_cart/'
                - '/^woocommerce_cart_hash/'
                - wp_woocommerce_session_
                - woocommerce_items_in_cart
                - woocommerce_cart_hash
    
    
    0

Please sign in to leave a comment.

 

Didn't find what you were looking for?

New post