WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
JS minify issue with Woocommerce (13 posts)

  1. JarkkoL
    Member
    Posted 1 year ago #

    Hi,

    Enabling JS minify seems to break Woocommerce variable product type, i.e. after selecting the variation the "Add to cart" button isn't shown. Is there any fix for this other than disabling JS minify?

    Thanks, Jarkko

    http://wordpress.org/extend/plugins/w3-total-cache/

  2. JarkkoL
    Member
    Posted 1 year ago #

    No one has solution to this? Currently when I have JS minify disabled my Yslow score drops from 89% to 78% so would be nice to have it fixed.

    Thanks, Jarkko

  3. patloq
    Member
    Posted 1 year ago #

  4. JarkkoL
    Member
    Posted 1 year ago #

    Yeah, I have already checked the page but it doesn't address this issue.

    I was able to track down the issue to be related to add-to-cart-variation.min.js script. The script fails when added to the combined JS file when JS minification is enabled and that's loaded in the beginning of the page. I added some code to Minify.php to remove the offending JS file from combining and now it works fine. Proper fix would probably be to fix add-to-cart-variation.min.js to work when loaded in the beginning of the page.

    My guess is that the script fails because when the script is loaded in the beginning of the page, the container it tries search for (single_variation_wrap) doesn't exists, while when the script is loaded in the original location the container has already been defined. I'm no JS script wizard though, but that's my non-web-programmer hunch (:

    Cheers, Jarkko

  5. patloq
    Member
    Posted 1 year ago #

    Hi Jarkko [ mod note: corrected spelling of name, that was a typo right? ], I'm not a JS crack. I'd just try to avoid the issue: via jsDelivr?
    http://wordpress.org/extend/plugins/jsdelivr-wordpress-cdn-plugin/
    Good luck, Patrick

  6. relativist
    Member
    Posted 1 year ago #

    i have this same exact issue as well.
    i can use the other aspect of the plug in, but once i try to implement minify, i lose the "add to cart" option.

  7. relativist
    Member
    Posted 1 year ago #

    jarkko, can you share your changes in the files?

  8. dizziness
    Member
    Posted 1 year ago #

    I've been struggling with this for some time. The solution is to switch to manual in minify and exclude this JS from minify (for me).

  9. JarkkoL
    Member
    Posted 1 year ago #

    I think it actually works now with the latest Woocommerce/W3TC. I updated to latest W3TC recently which overwrote my changes to Minify.php (AFAIK), and I don't have this problem anymore.

  10. dizziness
    Member
    Posted 1 year ago #

    I cannot get minify to work reliably on any of my Dreamhost hosted WordPress blogs. I wonder if there isn't an issue on their end. I have no idea how to install the other minify tools.

  11. JarkkoL
    Member
    Posted 1 year ago #

    I'm having the website hosted on Dreamhost, and it seems to work fine.

  12. Jon Reader
    Member
    Posted 1 year ago #

    Having this problem whilst using W3 Total Cache and Woocommerce.

    Seems that the woocommerce js files do not like being minified. So for a simple, but non-optimal fix;

    W3 Total Cache > Minify > JS > Operations in areas > Combine only.

    Will post again, when I find a better fix.

  13. outlet2013
    Member
    Posted 12 months ago #

    is there anyone that can upload w3tc config files to share?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.