• Resolved erikdemarco

    (@erikdemarco)


    Im using cloudflare to cache my wordpress.
    Before using dokan, my cache ratio is 99% (for 1000 pageviews 999 of the time visitor see cached page, saving my server resources).
    After installing dokan. it become 20%.

    Its because you set this ‘dokan_product_viewed’ cookie for each product pageview.
    Cloudflare or any cache system will not cache if there is setcookie in the response header.

    And guess what? There is no way to remove this functionality. I even remove it via this ‘dokan_get_class_container’ hook. Its not successfull because ‘\WeDevs\Dokan\PageViews()’ already called before ‘dokan_get_class_container’ fired.`

    • This topic was modified 2 years, 11 months ago by erikdemarco.
    • This topic was modified 2 years, 11 months ago by erikdemarco.
Viewing 1 replies (of 1 total)
  • Hello @erikdemarco ,

    I understand your problem here.

    Please try after using this code in your theme’s functions.php file:

    add_action('init', function() {
        remove_action( 'template_redirect', array( dokan()->pageview, 'load_views' ), 25 );
    });

    I have checked with my browser & the cookie dokan_product_viewed was not a part of the single product page after using this code.

    If you want to take this further & request to have a hook/filter to remove the cookie specifically, feel free to open an issue stating the scenario in our Dokan Lite Github repository: https://github.com/weDevsOfficial/dokan/issues

    Thank you 🙂

Viewing 1 replies (of 1 total)
  • The topic ‘Dokan makes any cache plugin/system useless…’ is closed to new replies.