• Resolved rcanny

    (@rcanny)


    After a recent update (not sure if WooCommerce or Autoptimize) all my WooCommerce variable product pages were broken with product images, text and prices missing. The dropdown boxes were still visible. After a process of elimination we found that Autoptimize’s JavaScript Options optimization was causing the conflict. We are using Enfold theme.

    I’m not a developer, but would like some help to find the script on these WooCommerce variable product pages that could be excluded so I can turn the module back on in Autoptimize. Thank you!

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

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    Try plugins/woocommerce/assets/js/frontend/add-to-cart-variation.min.js or plugins/woocommerce/assets/. While doing so, keep an eye on the JavaScript errors on the browser console, those can help identify the problem.

    hope this helps,
    frank

    Thread Starter rcanny

    (@rcanny)

    Hello, thanks so much for your help.
    Excluding: plugins/woocommerce/assets
    did the trick.
    Thanks!
    Richard

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    you’re welcome, feel free to leave a review of the plugin and support here! ??

    frank

    Thread Starter rcanny

    (@rcanny)

    Hello, we’ve notice that with autoptimize turned on the prices are not showing up for the variable products. When we turn autoptimize off everything works correctly.
    In addition to plugins/woocommerce/assets there must be another script that woocommerce uses for variable products.I also have plugins/woocommerce/assets/js/frontend/add-to-cart-variation.min.js excluded.

    The drop down selections for the variations are working, it’s just there is no price displayed. I looked in the console (but I am not a developer) and here is what I see in red:

    add-to-cart-variation.min.js:1 Uncaught ReferenceError: wp is not defined
    at l (add-to-cart-variation.min.js:1)
    at HTMLFormElement.t.onFoundVariation (add-to-cart-variation.min.js:1)
    at HTMLFormElement.dispatch (jquery.js:1)
    at HTMLFormElement.r.handle (jquery.js:1)
    at Object.trigger (jquery.js:1)
    at HTMLFormElement.<anonymous> (jquery.js:1)
    at Function.each (jquery.js:1)
    at n.fn.init.each (jquery.js:1)
    at n.fn.init.trigger (jquery.js:1)
    at HTMLFormElement.t.onFindVariation (add-to-cart-variation.min.js:1)
    l @ add-to-cart-variation.min.js:1
    t.onFoundVariation @ add-to-cart-variation.min.js:1
    dispatch @ jquery.js:1
    r.handle @ jquery.js:1
    trigger @ jquery.js:1
    (anonymous) @ jquery.js:1
    each @ jquery.js:1
    each @ jquery.js:1
    trigger @ jquery.js:1
    t.onFindVariation @ add-to-cart-variation.min.js:1
    dispatch @ jquery.js:1
    r.handle @ jquery.js:1
    trigger @ jquery.js:1
    (anonymous) @ jquery.js:1
    each @ jquery.js:1
    each @ jquery.js:1
    trigger @ jquery.js:1
    (anonymous) @ add-to-cart-variation.min.js:1
    setTimeout (async)
    t @ add-to-cart-variation.min.js:1
    C.fn.wc_variation_form @ add-to-cart-variation.min.js:1
    (anonymous) @ add-to-cart-variation.min.js:1
    each @ jquery.js:1
    each @ jquery.js:1
    (anonymous) @ add-to-cart-variation.min.js:1
    i @ jquery.js:1
    fireWith @ jquery.js:1
    ready @ jquery.js:1
    J @ jquery.js:1

    Thanks!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Can you try adding wp-includes to the comma-separated JS optimization exlusion list?

    Thread Starter rcanny

    (@rcanny)

    That worked! Thanks very much for your help.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    you’re welcome rcanny ??

    Thread Starter rcanny

    (@rcanny)

    Hi,
    We noticed that the problem has reappeared again. Everything works fine with JS optimization turned off. When we turn it on, our variable products don’t have the price showing.

    Here is our current exclusion list:
    wp-includes/js/dist/, wp-includes/js/tinymce/, js/jquery/jquery.js, sv-wc-payment-gateway-payment-form.min.js, wc-authorize-net-cim.min.js, plugins/woocommerce/assets/, plugins/woocommerce/assets/js/frontend/add-to-cart-variation.min.js, ai.min.js

    Thanks so much for your help!

    Richard.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    So what JS errors do you see on the console?

    Thread Starter rcanny

    (@rcanny)

    Hello,
    Sorry, but I’m not a developer…just a user ??
    But here is one page that has the issue. I turned AO JS optimization back on so you could perhaps see the error real time.
    https://www.ultimationinc.com/replacement-parts/buy-rs14/gravity-conveyor-1-38-dia-rollers-12-w-10-l-steel

    Normally the price will show up inside the gray bar near where the quantity is showing. The price changes according to the three variables in the drop down.
    Thanks!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    have a look at https://www.ads-software.com/support/article/using-your-browser-to-diagnose-javascript-errors/#step-3-diagnosis for info on how to see those JS error messages maybe? ??

    Thread Starter rcanny

    (@rcanny)

    Here is what I found:
    DOM7011: The code on this page disabled back and forward caching. For more information, see: https://go.microsoft.com/fwlink/?LinkID=291337
    gravity-conveyor-1-38-dia-rollers-12-w-10-l-steel
    HTML1300: Navigation occurred.
    gravity-conveyor-1-38-dia-rollers-12-w-10-l-steel
    HTML1512: Unmatched end tag.
    gravity-conveyor-1-38-dia-rollers-12-w-10-l-steel (358,77806)
    SEC7115: :visited and :link styles can only differ by color. Some styles were not applied to :visited.
    gravity-conveyor-1-38-dia-rollers-12-w-10-l-steel
    SCRIPT1009: Expected ‘}’
    autoptimize_5679825239b1344c5c5cfc9124bb30d1.js (1597,862)

    The first two items have a warning symbol; the final item relating to script 1009 and autoptimize has the large X symbol.

    Thanks!

    Richard.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, can you disable the Javascript “try/catch wrapping” option?

    Thread Starter rcanny

    (@rcanny)

    Hello,
    That seems to be working. Thanks very much for your help!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    you’re welcome rcanny ??

    have a nice weekend!
    frank

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘WooCommerce variable products broken with Autoptimize’ is closed to new replies.