• Resolved arithdevlpr

    (@arithdevlpr)


    I am trying really hard to figure out how to be able to cache my product pages but still have a “add to quote” button generated by a separate plugin to work. I do not have ESI enabled.

    When the page is cached, the default add to cart works fine but not this third party plugin. It just reloads the page without doing anything and then when i revisit or trigger the proper add to cart it serves the fresh page. The issue is similar to the one posted here: https://www.ads-software.com/support/topic/add-to-cart-is-reloading-the-page/ but from his solution on adding exclusions i’m not entirely sure if i’m adding the full urls to the right section under Tuning settings for both CSS and JS.

    Report number:?PFTHAORA

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

Viewing 7 replies - 16 through 22 (of 22 total)
  • Plugin Support qtwrk

    (@qtwrk)

    yes, if ajax can be added , it will be great

    sadly no , currently no feature like that to trigger crawler ??

    Thread Starter arithdevlpr

    (@arithdevlpr)

    So I did abit more testing and after a few days of rollout I am still experiencing some issues with the add to quote button is not functioning for simple products. e.g https://rifftsafety.co.nz/product/aertec-optomax/

    It seems that after the session ends, when a new session is started the initial cached/re-cached page is not triggering the code on button press.

    To test this:

    1. Initial session: open incognito mode, open a product page, and Add to Quote. It will not work. But press “Add to Cart” and it will work and should refresh the page and show the cart overlay. From now on if you press “Add to Quote” it will work. Even if you navigate to another product and try to add that product to quote.
    2. Close the session and open a new incognito browser. same thing as the initial session if you press the add to quote it will not work. But it will start working after you press “Add to Cart”.

    So as long as you don’t close the browser, the Add to Quote button will work.

    • This reply was modified 2 weeks ago by arithdevlpr. Reason: added "simple products" type
    Thread Starter arithdevlpr

    (@arithdevlpr)

    Okay I fixed it by adding an OR operator to check the action for single products which is just add_to_quote_single without the _vari at the end. Seems to be working good so far.


    /* quote enquiry code*/
    function lscwp_custom_purge_on_add_cart() {
    if ($_SERVER['REQUEST_METHOD'] === 'POST' && defined('LSCWP_V')) {
    if (
    isset($_POST['action']) && (
    $_POST['action'] === 'add_to_quote_single_vari' ||
    $_POST['action'] === 'add_to_quote_single'
    ) &&
    isset($_POST['product_id'])
    ) {
    do_action( 'litespeed_purge_post', $_POST['product_id'] );
    }
    }
    }
    add_action('init', 'lscwp_custom_purge_on_add_cart');

    function buffer_output_before($content) {
    if (strpos($content, 'Products in your quote enquiry basket') !== false) {
    @header('X-LiteSpeed-Cache-Control: no-cache');
    }
    return $content;
    }

    add_filter('litespeed_buffer_before', 'buffer_output_before', 0);
    /end quote enquiry code/
    Plugin Support litetim

    (@litetim)

    Thread Starter arithdevlpr

    (@arithdevlpr)

    yes that button is on which has initially fixed the “add to cart” woocommerce button. the issue with this “add to quote” button is because its from another developer and i guess it doesnt use the same ajax method

    Plugin Support qtwrk

    (@qtwrk)

    no , for default cart, the woocommerce generates a cookie , that option is to enable cookie vary on this cookie

    but the quote doesn’t set such cookie , and if it has multiple different action to set quote , you may need to include them all into the code snippet

    Thread Starter arithdevlpr

    (@arithdevlpr)

    oh i see. okay well for the time being it’s working after i added both lines that accounts for variable and simple products. ??

    thanks again for your quick help looking into this

Viewing 7 replies - 16 through 22 (of 22 total)
  • You must be logged in to reply to this topic.