Skip to main content

Add to cart does nto work for anonymous users in WooCommerce

Comments

1 comment

  • Charles-Antoine FOURNEL

    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.