• Resolved discsox

    (@discsox)


    Autoptimize breaks WooCommerce PayPal Powered by Braintree Gateway plugin.
    Once the autoptimize plugin is enabled, the JavaScript does not load correctly which prevents displaying the PayPal button and entering credit card, exp date and CCV.
    It used to work with PayPal version 1.2.7 but stopped working with version 2.x

    I also let the PayPal developers know.

    Any help to get this to work would be greatly appreciated.

    kind regards,

    Marcello

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter discsox

    (@discsox)

    Just wanted to clarify: Once i turn the Optimize JavaScript Code off in Autoptimize, PayPal plugin works again.

    Marcello

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    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

    Thread Starter discsox

    (@discsox)

    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?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    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 ??

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    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 ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Autoptimize breaks WooCommerce PayPal Plugin’ is closed to new replies.