• Resolved mf_iii

    (@mf_iii)


    Hello,

    I have a very weird problem! When i UNCHECK the last option to NOT optimize cart and checkout page, the coupon field in checkout page is disappearing!

    Also it has stuck and even if i disable the plugin the coupon is gone! It is showing only if i enable to optimize the cart/checkout!

    Can you explain me this?

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

Viewing 10 replies - 16 through 25 (of 25 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, but just above that you also have “Aggregate JS-files?”, what happens when you uncheck that?

    Thread Starter mf_iii

    (@mf_iii)

    Coupn not showing ??

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, as it works when CSS optimization is on and CSS optimization is not risky to do on cart/ checkout, I propose to keep the “optimize cart”-option checked and to use the following code snippet to disable JS optimization on cart & checkout;

    add_filter('autoptimize_filter_js_noptimize','mfiii_js_noptimize');
    function mfiii_js_noptimize() {
        if ( ( function_exists('is_checkout') && is_checkout() ) || ( function_exists('is_cart') && is_cart() ) ) {
            return true;
        } else {
            return false;
        }
    }

    fingers crossed ??
    frank

    Thread Starter mf_iii

    (@mf_iii)

    So only js needs to be dynamic?

    THis code goes to functions.php ?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    So only js needs to be dynamic?

    well, given your test results, optimizing CSS was enough to allow the coupon field to be seen, so indeed the code snippet disables JS optimization for cart/ checkout.

    THis code goes to functions.php ?

    I generally recommend using the code snippets plugin, but it should work in functions.php as well yes.

    Thread Starter mf_iii

    (@mf_iii)

    Ok thanks.

    Btw, i tested the checkout page since yesterday with the last checkbox enabled, and seems that checkout page works without problem. Is that possible? It has dynamic content

    Thread Starter mf_iii

    (@mf_iii)

    I put the code and coupon not showing! So js must be enabled..

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Darn, that’s a bummer! :-/

    Next question: based on your un-optimized HTML you have a plugin that is adding a defer-flag to your JavaScript (in a wrong fashion even), e.g.

    
    <script type='text/javascript' src='https://lolday.gr/wp-content/plugins/woocommerce/assets/js/frontend/cart-fragments.min.js' defer '></script>

    Guess that’s a plugin, can you deactivate that?

    Thread Starter mf_iii

    (@mf_iii)

    Hmm which plugin? How can i find it?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    that I don’t know mf_iii, I can only see the result (the defer flag). if you have no idea you’ll probably have to disable/enable plugins one at a time (with JS optimization off) and check the HTML source for presence of that defer flag.

    This defer flag is probably what is the reason for the issue;
    * you have inline JS that depends on linked JS-files, but the linked JS is loaded late (due to defer), so the inline JS breaks (I see some inline JS targetting the coupon field)
    * when AO JS optimization is active with “also aggregate inline JS”, the linked JS-files are no longer aggregated and all is executed in the correct order

    frank

Viewing 10 replies - 16 through 25 (of 25 total)
  • The topic ‘Coupon field gone when i disable optimizing cart/checkout’ is closed to new replies.