Just wanted to clarify: Once i turn the Optimize JavaScript Code off in Autoptimize, PayPal plugin works again.
Marcello
well, you have some options here;
* try to exclude some of the JS on your checkout
* switch to AO 2.2 beta, which has an option to disable AO on checkout/ cart
* use a code snippet to disable AO on cart/ checkout;
add_filter('autoptimize_filter_noptimize','noptimize_checkout',10,0);
function noptimize_checkout() {
if ( is_cart() || is_checkout() ) {
return true;
} else {
return false;
}
}
hope this helps,
frank
Hi Frank,
Thank you VERY much for your quick response. Adding the filter fixed the issue while I still was able to compress all the other js files.
thanks again and kind regards,
Marcello
Hi Frank
Disabling “Also optimize shop basket…” option does indeed fix this issue with Braintree. Thanks!
However this obviously means we lose all that lovely optimisation at a critical stage in the purchasing process, and we would love to find a fix for this if at all practical.
We aren’t aggregating inline, and excluding wc-braintree.min.js, we get an Uncaught TypeError: b(…).block is not a function in the wc-braintree.min.js script.
We also exclude braintree.js and button.js.
Any ideas?
try excluding the entire plugin maybe? suppose the plugin is at wp-content/plugins/woocommerce-paypal/ then you could use that as exclusion string. also see what happens if you do “aggregate inline JS” (watch out for cache size though) maybe? and the “try/catch”-wrapper, although ugly, sometimes works as well 🙂
if those do not work, you’ll have to do some trial and error, excluding other JS one by one until it works. not fun maybe, but it should pay off in the end.
hope this helps,
frank
Hey guys, just to let you know, I had an issue on our site where the WooCommerce account login link in checkout wasn’t working. We found that Autoptimize was causing this.
Adding the filter you provided above worked to resolve this issue too 🙂
Adding the filter you provided above worked to resolve this issue too
since AO 2.2 there’s even a simple checkbox you can tick to disable AO on checkout, which is what the filter does too @markzahra 🙂