• Resolved fkoomek

    (@fkoomek)


    Hello.
    I am playing with the settings of the section Purge Policy: Page Cache.
    I am using W3 Total Cache with Woocommerce and I have set the policy that way that when I update a product, all categories containing this product are purged. That’s fine.
    However, I um using a product filter and I am caching results of this filter (I am caching query strings). This filter adds query ?filter to URL. The results of the product filter are not purged after update of the product, of course.
    So, is there any way how to purge pages with specific query strings on update products? In this specific case, I need to purge pages containing ?filter on update any product.
    Thanks

    • This topic was modified 6 years, 1 month ago by fkoomek.
    • This topic was modified 6 years, 1 month ago by fkoomek.
    • This topic was modified 6 years, 1 month ago by fkoomek.
Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @fkoomek

    I am sorry about the issue you are experiencing and I am happy to assist you with this.
    Have you tried purging those pages programmatically using w3tc_flush_url($url)
    E.G.
    w3tc_flush_url(‘http://domain.com/page?query=1’);
    Thank you!

    Thread Starter fkoomek

    (@fkoomek)

    Hello.
    Thank you for your help.
    Your code works only for a particular page. Is there a way how to purge all pages containing “?filter” ? For examples this is full URL:
    https://www.test.liberlapidum.com/cs/?filters=country%5Bpakistan%5D

    But I need to purge every page containing ?filters.
    Thank you

    • This reply was modified 6 years, 1 month ago by fkoomek.
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @fkoomek

    Thank you for the information.
    While we are checking this you can try a custom code and hook onto the post-update hook, fetch all posts in the same tag/category and call w3tc_flush_url($url) on those posts.
    I’ll reply back after we make tests.
    Thank you!

    Thread Starter fkoomek

    (@fkoomek)

    Thank you for the reply.
    But I don’t understand how that could help me in my case. I need to clear URLs containing certain query strings which are created dynamicaly.
    I will wait for further assistance πŸ™‚

    Thread Starter fkoomek

    (@fkoomek)

    Hello Marko. Do you have any news please?
    Thank you.
    Radan

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @fkoomek

    We are still testing this but it appears that URL with query strings are not getting purged.
    We’ll let you know as soon as we perform some more testing.
    Thank you!

    Thread Starter fkoomek

    (@fkoomek)

    Ok, thanks.

    Thread Starter fkoomek

    (@fkoomek)

    Hello.
    Any news, please?
    Thank you

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @fkoomek

    Sorry for the delay. We are still checking this.
    Once again sorry for the delay.

    Thread Starter fkoomek

    (@fkoomek)

    Hello Marko. Any progress?
    Thanks

    Is it really possible to purge products list page every time a new product is updated. You achieved that @fkoomek ? Tks! πŸ˜‰

    Thread Starter fkoomek

    (@fkoomek)

    Hi.
    It’s possible to purge all categories containing the given product when the product is updated. And also all attributes pages related to the product. In “Purge Policy: Page Cache” section I have checked these options: Front page, Posts Page, Post Page, Post terms pages, Post terms feeds. I am not sure if all of the options are needed to be checked but it works.

    • This reply was modified 5 years, 6 months ago by fkoomek.

    It seems the product shows up for the category page, but not for the general products list, like /shop/ list. But for /category-product/ is shows up. Any more idea? Tks! πŸ™‚

    Thread Starter fkoomek

    (@fkoomek)

    Hello.
    So are you saying that your “shop” page which is defined by Woocommerce is not purged? That’s weird. You could try to purge URLs programmatically. You can try to use this code:

    add_action('woocommerce_update_product', 'mp_sync_on_product_save', 10, 1);
    function mp_sync_on_product_save()
    {
    w3tc_flush_url($url);
    
    }

    Just replace $url with the exact URL you need to purge.
    But there could be a problem when you have more pages of the “product list”.
    So you would probably have to include all pages like:

    add_action('woocommerce_update_product', 'mp_sync_on_product_save', 10, 1);
    function mp_sync_on_product_save()
    {
    w3tc_flush_url('https://www.yoursite.com/shop/');
    w3tc_flush_url('https://www.yoursite/shop/page/2/');
    w3tc_flush_url('https://www.yoursite/shop/page/3/');
    
    }

    Be sure to include the exact address including the right certificate (if you don’t have an SSL certificate you would use http://)…

    Code goes into your functions.php

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Purge Policy:Page Cache’ is closed to new replies.