Jump to content

Replying to Stripe's Checkout.js File Being Loaded On Every Page

Post Options

  or Cancel

Topic Summary


Posted 29 September 2014 - 11:04 AM

I would like to add that I would appreciate Stripe Checkout scripts added only on iThemes Exchange pages too. I couldn't find it in the Trello Roadmap to add my vote.


Rob Hess

Posted 14 March 2014 - 02:48 PM

Thanks Ronald!


Posted 14 March 2014 - 09:23 AM

Hi Rob,

I have added this as an enhancement request for the developers to look into,


Rob Hess

Posted 13 March 2014 - 10:01 PM

I noticed this as well. Thanks Ronald, for the response. I'll test your approaches and see how that goes.

As an aside, It seems strange that Exchange loads Stripe's checkout.js on every page when Exchange currently only allows the actual checkout process to occur on product pages. I believe Exchange also manages product pages (I don't think there's any other option right now). It'd be handy if Exchange would be able to detect and add checkout.js automatically to those product pages.

In my case, checkout.js takes between 500 and 600 milliseconds to load, which makes up a bit less than half of my total load time (1.36s). Personally, I'd love to see this changed in the next version of the Stripe plugin.




Posted 22 February 2014 - 07:41 AM

Hi AJ,

you can add the following code at the end of your child theme's functions.php (but before a closing ?>, if any):

function my_stripe_enqueue_scripts() {
	if ( !it_exchange_is_page() ||  !function_exists( 'it_exchange_stripe_addon_enqueue_script' ) ) {
		wp_dequeue_script( 'stripe' );
		wp_dequeue_script( 'stripe-addon-js' );
add_action( 'wp_enqueue_scripts', 'my_stripe_enqueue_scripts', 99);

This is fairly "rough" way to unload these scripts when NOT on an Exchange page. More granular control can be done using a condition such as:

	if ( !it_exchange_is_page( 'checkout' ) ||  !function_exists( 'it_exchange_stripe_addon_enqueue_script' ) ) {

which will test for the "checkout" page specifically, but this may(!) be too tight, and the plugin may not function properly,


Andrew Morris

Posted 21 February 2014 - 07:07 PM

Hey Exchange peeps!

I'm really trying to get my site to load a little faster and I'm noticing that on non-exchange pages, the checkout.js file is being called and loaded. I'm wondering why this is the case? Isn't there a way to load this file only on the checkout/product/pages with the super widget? I'm also noticing that stripe-addon.js is being called in the same manner.

I would really like to get these loading only on the right pages. If it's something I need to do, I'll gladly update some code to make this happen.

You can checkout the site here, http://ajmorris.me.

I'm also including BackupBuddy's server config to give you an idea of what I've got going on here.

[OK]     BackupBuddy Version   =
[OK]     WordPress Version   =   3.8.1
[OK]     MySQL Version   =   5.5.35
[OK]     AddHandler in .htaccess   =   none, n/a
[OK]     PHP Version   =   5.4.6-1ubuntu1.5
[OK]     PHP max_execution_time (server-reported)   =   30
[OK]     PHP Memory Limit   =   256M
[OK]     Zip Methods   =   exec, ziparchive, pclzip  
[WARNING]     Database Dump Methods   =   php
[OK]     Site Size   =   Unknown  
[OK]     Site Size (Default Exclusions applied)   =   Unknown  
[OK]     Site number of files   =   Unknown  
[OK]     Site number of files (Default Exclusions applied)   =   Unknown  
[OK]     Database Size   =   6.86 MB  
[OK]     Database Size (Default Exclusions applied)   =   6.86 MB  
[OK]     Average Write Speed   =   451 KB/sec
[OK]     Guesstimate of max ZIP size   =   13.21 MB
[OK]     Http Loopbacks   =   enabled
[OK]     WordPress Cron   =   enabled
[OK]     WordPress Alternate Cron   =   disabled (default)
[OK]     Disabled PHP Functions   =   pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
[OK]     PHP Register Globals   =   disabled
[OK]     PHP Magic Quotes GPC   =   disabled
[OK]     PHP Magic Quotes Runtime   =   disabled
[OK]     PHP Safe Mode   =   disabled
[OK]     PHP API   =   fpm-fcgi
[OK]     PHP Architecture   =   64-bit
[OK]     Http Server Software   =   nginx/1.2.1
[OK]     Server Load Average   =   0.43, 0.15, 0.15
[OK]     PHP SSH2, SFTP Support   =   no, no
[OK]     WordPress ABSPATH   =   /home/wordpress/public_html/
[OK]     Operating System   =   Linux (Linux bazinga 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64)
[WARNING]     Active WordPress Plugins   =   gravityforms/gravityforms.php, CDN-Linker-master/wp-cdn-linker.php, admin-bar-disabler/admin-bar-disabler.php, akismet/akismet.php, backupbuddy/backupbuddy.php, exchange-addon-mailchimp/exchange-addon-mailchimp.php, exchange-addon-recurring-payments/exchange-addon-recurring-payments.php, exchange-addon-stripe/exchange-addon-stripe.php, floating-social-bar/floating-social-bar.php, gistpress-master/gistpress.php, google-analyticator/google-analyticator.php, gravityformsmailchimp/mailchimp.php, gravityformspolls/polls.php, gravityformszapier/zapier.php, ithemes-exchange/init.php, lazy-load/lazy-load.php, optin-monster-slide/optin-monster-slide.php, optin-monster/optin-monster.php, thirstyaffiliates/thirstyaffiliates.php, w3-total-cache/w3-total-cache.php, wordpress-seo/wp-seo.php, wp-migrate-db-pro-media-files/wp-migrate-db-pro-media-files.php, wp-migrate-db-pro/wp-migrate-db-pro.php, wp-optimize/wp-optimize.php, wp-retina-2x/wp-retina-2x.php, wp-smushit/wp-smushit.php
[OK]     PHP Process User (UID:GID)   =   www-data (33:33)

Would definitely love to get this solved if possible. Thanks!


Review the complete topic (launches new window)