TLDR: If you want faster credit card AJAX load times in EDD, disable the “Show previously used cards” setting in EDD.
Hint: It only happens when you or a customer are logged-in.
I’ve recently found that it can take up to 8 seconds for the credit card fields to load when working on the GravityView website in a local environment.
I thought maybe there were other plugins loading during the
admin-ajax.php call that were adding load time.
The load time was a problem only when a user is logged-in and when using the EDD Stripe payment gateway.
The issue? The “Show previously used cards” setting.
When “Show previously used cards” is enabled, there’s a round-trip request to Stripe to ask for the user’s saved credit cards. No big deal, right?
In production, that request takes ~1.7 seconds with the setting enabled. That’s not ideal, but it’s okay because it’s loading asynchronously. With the setting disabled, the AJAX request is .5 seconds faster.
In my testing environment, the request takes 8 seconds with the setting enabled, and only 0.5 seconds when disabled!
I’m turning the “Show previously used cards” setting off in my local environment and saving 8 seconds of my life each time I view the checkout page.
For the GravityView site, I’m going to leave the setting enabled. I think the .5 second tradeoff is worth the increased ease of use for customers.