Title: Stripe WordPress Plugin not working if Javascript is optimized
Last modified: September 1, 2016

---

# Stripe WordPress Plugin not working if Javascript is optimized

 *  Resolved [Fangelo360](https://wordpress.org/support/users/fangelo360/)
 * (@fangelo360)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/stripe-wordpress-plugin-not-working-if-javascript-is-optimized/)
 * Hello!
 * This plugin is great, I am running a terrible theme called shopkeeper based on
   Visual Composer that does around 140-160 queries per page and your plugin reduce
   them to 50-60!
 * My only issue is that if I optimize Javascript checkout with the official Stripe
   Plugin from Automattic can’t run properly, after putting credit card’s informations
   I get the message;
 * **Developers: Please make sure that you are including jQuery and there are no
   JavaScript errors on the page.**
 * I tried all the combinations of options and I excluded stripe.js but it keeps
   not working.
 * Is there a way to exclude the plugin from the checkout page? Is there any solution
   you advise me to try?
 * Thank you so much!
 * [https://wordpress.org/plugins/autoptimize/](https://wordpress.org/plugins/autoptimize/)

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Thread Starter [Fangelo360](https://wordpress.org/support/users/fangelo360/)
 * (@fangelo360)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/stripe-wordpress-plugin-not-working-if-javascript-is-optimized/#post-7590042)
 * Here is a screenshot of the jQuery problems I found on the checkout page;
 * [http://uploadpie.com/KOxLo](http://uploadpie.com/KOxLo)
 * I hope it can help 🙂
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/stripe-wordpress-plugin-not-working-if-javascript-is-optimized/#post-7590062)
 * ah, “jQuery is not defined”, in that case you add `js/jquery/jquery.js` to the
   comma-separated list of JS optimization exclusion 🙂
 * if that does not work, you can indeed excluded the checkout from autoptimization
   using the API. let me know if you want to go down that path (if excluding jQuery
   does not fix the problem).
 * frank
 *  Thread Starter [Fangelo360](https://wordpress.org/support/users/fangelo360/)
 * (@fangelo360)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/stripe-wordpress-plugin-not-working-if-javascript-is-optimized/#post-7590067)
 * Thank you for your advise!
 * By adding s/jquery/jquery.js I solved those jQuery mistakes, however I still 
   receive a generic message that says that it wasn’t possible to complete the operation.
   I can’t find any real issue from the console so I guess excluding checkout page
   might be the best choice.
 * I forgot to tell you that my website is on http but checkout is done on https,
   does this influence somehow the procedure?
 * Thank you again for your support!
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/stripe-wordpress-plugin-not-working-if-javascript-is-optimized/#post-7590069)
 * http vs https does not really make a difference for autoptimize, no.
 * maybe try excluding jquery AND stripe.js?
 * else you can exclude the checkout using this code (which assumes the URL contains‘/
   checkout’);
 *     ```
       add_filter('autoptimize_filter_noptimize','checkout_noptimize',10,0);
       function checkout_noptimize() {
       	if (strpos($_SERVER['REQUEST_URI'],'/checkout')!==false) {
       		return true;
       	} else {
       		return false;
       	}
       }
       ```
   
 * You can use e.g. [the code snippets plugin](https://wordpress.org/plugins/code-snippets/)
   to add and activate this snippet.
 * frank
 *  Thread Starter [Fangelo360](https://wordpress.org/support/users/fangelo360/)
 * (@fangelo360)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/stripe-wordpress-plugin-not-working-if-javascript-is-optimized/#post-7590179)
 * Hey thank you so much for your support!
 * I am really appreciating it, I am in the middle of the tax season in my country,
   as soon as I am out of it I will definitely make a donation based on the instructions
   I found on your website.
 * I excluded both by writing stripe.js,js/jquery/jquery.js but it was still not
   working so I just used your useful code and excluded the checkout page, now the
   website is much much faster!
 * Thank you again for your precious support!
 *  Thread Starter [Fangelo360](https://wordpress.org/support/users/fangelo360/)
 * (@fangelo360)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/stripe-wordpress-plugin-not-working-if-javascript-is-optimized/#post-7590184)
 * Hello again!
 * Right now everything is working fine, however there is a big difference between
   the results I got days ago from gtmetrix when I tested your plugin for the first
   time and the results I get now.
 * This is the result I got **2 days ago**;
    [https://gtmetrix.com/reports/www.lovelymatcha.it/fZ4Vxw0X](https://gtmetrix.com/reports/www.lovelymatcha.it/fZ4Vxw0X)
 * Pagespeed **1.48 seconds** | Page Size 1.42 | Requests 58
 * This is **today**;
    [https://gtmetrix.com/reports/www.lovelymatcha.it/uCKZts1r](https://gtmetrix.com/reports/www.lovelymatcha.it/uCKZts1r)
 * Pagespeed **10.9 seconds** | Page Size 1.41 | Requests 55
 * The only difference I see is that today the field DEFER PARSING OF JAVASCRIPT
   has a 0 score but 2 days ago it was 58.
 * Plus if I check the tab WATERFALL I notice that the first line takes 4.92 seconds
   to be downloaded and I can’t recognize what’s that, maybe the response time of
   the server?
 * Do you have any advise on how to solve the problem? The website is super fast
   now except for those 4-5 seconds in the beginning.
 * I even deleted and reinstalled it to see if I messed up something with settings.
 * Thank again you for your support!
 *  Thread Starter [Fangelo360](https://wordpress.org/support/users/fangelo360/)
 * (@fangelo360)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/stripe-wordpress-plugin-not-working-if-javascript-is-optimized/#post-7590187)
 * PLEASE IGNORE MY REQUEST, I AM 100% SURE IT IS BECAUSE OF MY HOSTING PROVIDER.
 * Thank you!
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/stripe-wordpress-plugin-not-working-if-javascript-is-optimized/#post-7590188)
 * well, there’s room for improvement in AO’s config;
    * for “defer parsing”, try
   disabling “force JS into head”. you might have to “aggregate inline JS” as well
   and do some other tweaks. * for the first line; this is the base HTML. I did 
   [a quick test on webpagetest.org](http://www.webpagetest.org/result/160722_EC_8D7/)
   and with approx. 130ms your “time to first byte” is very good actually
 * frank

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Stripe WordPress Plugin not working if Javascript is optimized’ is closed
to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * Last activity: [9 years, 10 months ago](https://wordpress.org/support/topic/stripe-wordpress-plugin-not-working-if-javascript-is-optimized/#post-7590188)
 * Status: resolved