Support » Plugin: Autoptimize » blocks add to cart

  • Resolved not1_name

    (@not1_name)


    Amazing plugin! But can’t aggregate JS-files as can’t add products to cart on a woocommerce site. I assume it is blocking the ajax call. I assumed there would be an easy fix or workaround on the Net, but can’t find anything. Can this feature be used with woocommerce?

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

    (@optimizingmatters)

    Can you try unticking “also optimize cart/checkout” not1_name ? Does the problem go away when “aggregate JS” is off? And can you check the browser console for JS errors?

    frank

    Thread Starter not1_name

    (@not1_name)

    > Can you try unticking “also optimize cart/checkout”
    It always was unchecked. If it helps, we are using the Salient theme.

    > Does the problem go away when “aggregate JS” is off?
    Yes

    > And can you check the browser console for JS errors?
    I’ll need to wait until the early morning as this is a high traffic live site.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, keep “aggregate JS” off for now and update here when you can (re)test with it on to check for JS errors. Or maybe you have a development/ staging site where you can test?

    Thread Starter not1_name

    (@not1_name)

    If I turn on “aggregate JS” on, the errors are:

    Uncaught ReferenceError: fbq is not defined
    at HTMLDocument.<anonymous> (?v=13a5de22bbda:605)
    at i (jquery.js?ver=1.12.4-wp:2)
    at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4-wp:2)
    at Function.ready (jquery.js?ver=1.12.4-wp:2)
    at HTMLDocument.J (jquery.js?ver=1.12.4-wp:2)

    Clearly a jquery issue.

    The list of excludes is:

    wp-content/cache/, wp-content/uploads/, admin-bar.min.css, dashicons.min.css, js/jquery/jquery.js

    Any ideas?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Thread Starter not1_name

    (@not1_name)

    Thank you. Yes, I can see that the facebook pixel script(s) conflict with your plugin. Unfortunately the link you mentioned didn’t help.
    There must be other users who also have the facebook pixel script included (hopefully everyone who does e-commerce!). Have you heard of a solution? This must be a very common issue.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Well, try excluding the JS of the plugin that adds the FB pixel maybe?

    Thread Starter not1_name

    (@not1_name)

    There isn’t a plugin that does that. The site is connected via the FB for woocommerce plugin, but deactivating the plugin doesn’t remove the pixel. We can remove the pixel from our site, but that won’t help as there is no way we could run an ecom business without a pixel.

    I have spent half the day trying to find out how to use your plugin with a pixel and I cannot find a solution. I am surprised. It is unfortunate.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    the solution is not removing the facebook pixel (although that would help) but excluding any JS you have going that is related to that. if it is WooCommerce itself that is doing the hooking into FB, then you might have to try to exclude woocommerce from JS optimization?

    I’m 100% sure it can be fixed, you’ll just have to identify the right JS to be excluded 🙂

    Thread Starter not1_name

    (@not1_name)

    Yes, thank you. I was wondering if another customer had ever had this issue so that we could quickly apply a fix. As a pixel can only be linked to one site we cannot test on our local site and all testing has to be done on a live one. If you hear of another customer who uses your plugin with woocommerce, and has a issue, please let us know.

    Thread Starter not1_name

    (@not1_name)

    BTW, I think I have found the cause, and it may be helpful for your users. Our Pixel was being added by “Pixel your site”, which is a popular plugin. I added a catchall exclusion of plugins/pixelyoursite/ in addition to js/jquery/jquery.js, and this has prevented the errors.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    good job, thanks for sharing not1_name! 🙂

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘blocks add to cart’ is closed to new replies.