Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Frank Goossens

    (@futtta)

    there are multiple sites using WC + AO, but some configuration might be needed (multiple threads on this subject here in the autoptimize support forum).

    from what I see, page caching in general is done for all WC-pages except cart & checkout and AO can be configured not to be active on those pages (using the API, autoptimize_filter_noptimize, cfr. the example in autoptimize_helper.php_example)

    hope this clarifies,
    frank

    Thread Starter danina84

    (@danina84)

    Thank you for your fast reply. I activated the helper.php, but I am not sure how and where to add the relevant urls now?

    Plugin Author Frank Goossens

    (@futtta)

    there is only one block of relevant code;

    add_filter('autoptimize_filter_noptimize','my_ao_noptimize',10,0);
    function my_ao_noptimize() {
    	if (strpos($_SERVER['REQUEST_URI'],'no-autoptimize-now')!==false) {
    		return true;
    	} else {
    		return false;
    	}
    }

    in there the 3rd line will contains (part) of the URL and could become;
    (alert: untested code!)

    if ((strpos($_SERVER['REQUEST_URI'],'cart')!==false)||(strpos($_SERVER['REQUEST_URI'],'checkout')!==false) {

    hope this helps,
    frank

    Thread Starter danina84

    (@danina84)

    Yeah, this did not work at all, site went blank…

    Plugin Author Frank Goossens

    (@futtta)

    as I wrote, untested code, you might have to tinker with that block of code (or ask a developer for help).

    frank

    Plugin Author Frank Goossens

    (@futtta)

    OK, tested and there was a closing bracket missing. this at least will not cause your blank screen;

    if ((strpos($_SERVER['REQUEST_URI'],'cart')!==false)||(strpos($_SERVER['REQUEST_URI'],'checkout')!==false)) {

    frank

    Thread Starter danina84

    (@danina84)

    Thank you so much for having a look at it again. I guess the code still needs to be changed since it is still aggregating. I saw in the Woocoomerce docs that they tell you to exclude mfunc from minifying if you use W3. Since I am using AO for minifying, could this be a solution? I have no idea what mfunc is or does…

    Plugin Author Frank Goossens

    (@futtta)

    well, the code assumes the cart-page has “cart” in the path of the URL and the checkout has “checkout”, if that is not the case you would have to adjust those.

    I saw in the Woocoomerce docs that they tell you to exclude mfunc from minifying if you use W3.

    you could try adding that to the comma-separated JS-optimization exclusion list, yes. no idea what it does though πŸ™‚

    have fun,
    frank

    Thread Starter danina84

    (@danina84)

    Hi Frank,
    unfortunately I still haven’t been able to figure out how to exclude the Woocommerce pages from AO. I read somewhere to use is_cart and is_checkout instead of uri, but I am not sure how to implement this in your function?
    Thank you so much,
    danina

    Plugin Author Frank Goossens

    (@futtta)

    in that case the function would be something like this (beware, untested code coming up);

    add_filter('autoptimize_filter_noptimize','woo_noptimize',10,0);
    function woo_noptimize() {
    	if ( ( is_cart() ) || ( is_checkout() ) ) {
    		return true;
    	} else {
    		return false;
    	}
    }

    frank

    Thread Starter danina84

    (@danina84)

    Just getting back to you, this code works πŸ™‚ Thank you very much. I am just wondering if I should also include my single product pages in the code since they are not cached either…I only have 5 products so I could include them via is_page(…) but I am not sure if I could even leave AO on for these pages even if they are not cached.

    Just out of curiosity: i know BWP Minify has a cache busting option that you can also customize, I am not sure if this plugin works completely different but how come cache busting is possible with the other?

    Plugin Author Frank Goossens

    (@futtta)

    great to hear this works!

    regarding cache busting; you can empty the cache from the admin-page, there just is no automatic purging (to avoid pages becoming broken).

    frank

    Thread Starter danina84

    (@danina84)

    Hey Frank, yes I know I can empty the cache manually, it just takes VERY long to get the cache up again and it is a pain to go through every single page and post to make sure they are cached…

    Plugin Author Frank Goossens

    (@futtta)

    it just takes VERY long to get the cache up again and it is a pain to go through every single page and post to make sure they are cached…

    there’s a plugin for that πŸ™‚

    frank

    Thread Starter danina84

    (@danina84)

    Yes, but I don’t have a sitemap and really don’t want to install plugin over plugin… wish there was a way w/o plugin…

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘AO and Woocommerce’ is closed to new replies.