Press "Enter" to skip to content

Gravity Forms Stripe Issue: Credit Card input is removed when adding form to your template file

There appears to be bug or very poor documentation on Gravity Forms’ part when it comes to using the Stripe addon with a credit card field. This is in reference to Stripe addon 3.9.2 and WordPress 5.7. It make be earlier than that, thought.

If you are adding a gravity form via theme file, you would use the gravity_form() function.

That is fine and dandy 99% of the time, but with this Stripe addon the credit card input was completely gone from the dom. The cardholder name field showed up, just not the method to actually enter your credit card number.

Gravity Forms Stripe Addon Missing Input

After playing around for a very long time, I tried adding the form the the page in the back end via the content editor. Lo and behold the shortcode in the wysiwyg editor seems to render the form correctly with the credit card input.

I couldn’t figure out what that actually implied for a while. I tried running my gravity_form() call through “the_content” filter to see if that was adding something extra. I also tried do_shortcode() in my theme file to see if its a shortcode thing. No dice.

Finally, I inspected the page source on the front end where from both versions of the form ( theme file and content editor ) to compare what I am seeing.

Turns out jquery was being added to the theme header as a manual link and NOT the proper way of being enqueued in the wp_enqueue_scripts hook. I assume the Stripe Addon is dependent on jquery being enqueued so it doesn’t load all of the javascript required and therefore won’t show the credit card input field. I didn’t want to modify the theme any more than I had to since it is so old, so the work around was to put gravity_form_enqueue_scripts($form_id) above the get_header call of the template. This properly enqueued jquery on that page and allowed it to show the credit card field. Ideally you would properly enqueue it in the functions file to begin with, though.

Hopefully this saves someone a lot of time some day. Good luck!