• Resolved libormachac

    (@libor2001)


    Hi, is there any option how can i disable purging categories (main category and sub categories) after adding products? We have setup auto purge whole website at midnight so every category and product are updated at midnight so there is no outdated content to be displayed and we want to have cached site all day. And new products can be added next day.
    Thanks for help and have a nice day.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Support litetim

    (@litetim)

    Thread Starter libormachac

    (@libor2001)

    Im not speaking about purge product and categories when quantity stock changed. Im speaking about public/update product. I want when i add new product to not be visible instantly but after midnight purge whole site.

    Thread Starter libormachac

    (@libor2001)

    and have shop cached whole day without purging sites, when i make some critical change i always pruging it manually.

    Plugin Support litetim

    (@litetim)

    Ok
    Thank you for context.

    There are some actions added when woocommerce is active: \litespeed-cache\thirdparty\woocommerce.cls.php

    Also products are considered post types. I would look for a way to cancel purge when specific post type is added/edited/deleted.

    Plugin Support litetim

    (@litetim)

    when specific post type is added/edited/deleted.

    I meant to say: when specific post is added in product post type is added/edited/deleted.

    Thread Starter libormachac

    (@libor2001)

    yeah, so what can i do?

    Plugin Support qtwrk

    (@qtwrk)

    add_action('woocommerce_update_product', 'lscwp_suppress_purge_product_update', 10, 2);
    function lscwp_suppress_purge_product_update($product_id, $product) {
    ob_start( function($buffer) use ($product_id) {
    @header("X-LiteSpeed-Purge: nothing" );
    return $buffer;
    } );
    }

    please try this code.

    Thread Starter libormachac

    (@libor2001)

    Thanks, i will try and get back to you when i test it.

    Thread Starter libormachac

    (@libor2001)

    Hi, i added this code into wp code snippet and run everywhere, i tested it but when i published new product, categories were purged. I need when i edit or add new product, to not purge woocommerce categories pages.

    Plugin Support qtwrk

    (@qtwrk)

    [root@cp apache2]# tail -f error_log | grep -i x-litespeed-purge
    2024-09-26 11:41:49.184132 [DEBUG] [3013287] [T0] [79.xxx.xxx.110:63342-H3:AD5B80B9427449D0-840#APVH_woo.xxx.com:lsapi] Response Header: 'X-LiteSpeed-Purge: nothing'
    2024-09-26 11:41:49.184134 [DEBUG] [3013287] [T0] [79.xxx.xxx110:63342-H3:AD5B80B9427449D0-840#APVH_woo.xxx.com:lsapi] append response header: X-LiteSpeed-Purge: nothing

    I just tested it , it works on my test, edit it by URL like /wp-admin/post.php?post=48&action=edit

    what exactly did you do ?

    Thread Starter libormachac

    (@libor2001)

    Thread Starter libormachac

    (@libor2001)

    Plugin Support qtwrk

    (@qtwrk)

    I was doing theme’s functions.php , what happens if you do the same way ?

    Thread Starter libormachac

    (@libor2001)

    https://stofex.com/wp-admin/post.php?post=41813&action=edit
    I add this code into theme functions does not work, then in functions.php also does not work. Im lost

    Thread Starter libormachac

    (@libor2001)

    When i publish new product all categories are purged. When i just edit published product this code works great. So i need to add when i add new product dont purge categories.

Viewing 15 replies - 1 through 15 (of 18 total)
  • You must be logged in to reply to this topic.