Credit card fields intermittently disappear from checkout page
-
Shortly after updating the WordPress Payments plugin to v3.0.0, the credit card fields started intermittently disappearing from my checkout page. Issue has been observed in multiple browsers, on desktop and mobile, Android and iOS.
When it fails, I see these additional error messages:
Failed to load stats.wp.com/s-202139.js:1
resource: net::ERR_CONNECTION_REFUSEDFailed to load stats.wp.com/e-202139.js:1
resource: net::ERR_CONNECTION_REFUSEDjQuery.Deferred jquery.min.js?ver=3.6.0:2 exception: Stripe is not defined ReferenceError: Stripe is not defined at t.value (https://writelizwrite.com/wp-content/plugins/woocommerce-payments/dist/upe_checkout.js?ver=3.0.0:1:70067) at HTMLDocument.<anonymous> (https://writelizwrite.com/wp-content/plugins/woocommerce-payments/dist/upe_checkout.js?ver=3.0.0:1:110981) at e (https://writelizwrite.com/wp-includes/js/jquery/jquery.min.js?ver=3.6.0:2:30038) at t (https://writelizwrite.com/wp-includes/js/jquery/jquery.min.js?ver=3.6.0:2:30340) undefined
The page I need help with: [log in to see the link]
-
Hello @writelizwrite
I’d be glad to help. Reading over the error message, I have seen this occurring when a caching plugin is in use.
Is possible that the Stripe plugin’s JS files are being cached. Do you happen to have one installed? If so, please try disabling it first.
Could you please send me a copy of your site’s System Status? You can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”. Once you’ve done that, you can paste it here in your response.
Once we have that information, we’ll be in a better place to help.
I am having a similar issue on v 3.1.0:
On my /checkout page, when a user is NOT signed in, they get a “Credit card / debit card” section and all works correctly.
However, for signed in users on my site (e.g. signed in as role “subscriber”), if they go to /checkout then NO credit card section appears at all…instead there is just an empty section that says “WooCommerce Payments” and no ability to enter a credit card.
When I look in the chrome console, I see:
upe_checkout.js?ver=3.1.0:1 Uncaught TypeError: Cannot read properties of undefined (reading ‘apiFetch’)The error is being triggered by upe_checkout.js
If I type window.wp.apiFetch into the chrome console, I get the same error.
So I guess the question is why window.wp not defined for signed in users?
(or more generally, why does the credit card input form not appear for signed in users?)Thanks for any help!
- This reply was modified 3 years, 1 month ago by r-c.
Don’t know if this will help others, but I had this same problem with credit card field not appearing for signed in users. It came down to one line in my child theme functions.php file:
wp_deregister_script(‘wp-embed’);
Once I commented out that line, credit card field appeared for everyone, both signed in and signed out users.
Hi @nathvi sorry for missing your response. It doesn’t look like I have any caching plugins installed. My system report is pasted below. I don’t have user sign-in, so I don’t think it’s the same as the issue others in the thread have mentioned. Thanks.
### WordPress Environment ### WordPress address (URL): https://writelizwrite.com Site address (URL): https://writelizwrite.com WC Version: 5.7.1 REST API Version: ? 5.7.1 WC Blocks Version: ? 5.7.2 Action Scheduler Version: ? 3.2.1 WC Admin Version: ? 2.6.5 Log Directory Writable: ? WP Version: 5.8.1 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: – WP Cron: ? Language: en_US External object cache: – ### Server Environment ### Server Info: nginx/1.4.6 PHP Version: 7.2.13-1+ubuntu14.04.1+deb.sury.org+1 PHP Post Max Size: 8 MB PHP Time Limit: 30 PHP Max Input Vars: 1000 cURL Version: 7.35.0 OpenSSL/1.0.1f SUHOSIN Installed: – MySQL Version: ? 5.5.62-0ubuntu0.14.04.1 - We recommend a minimum MySQL version of 5.6. See: WordPress requirements Max Upload Size: 2 MB Default Timezone is UTC: ? fsockopen/cURL: ? SoapClient: ? Your server does not have the SoapClient class enabled - some gateway plugins which use SOAP may not work as expected. DOMDocument: ? GZip: ? Multibyte String: ? Remote Post: ? Remote Get: ? wp_remote_get() failed. Contact your hosting provider. ### Database ### WC Database Version: 5.7.1 WC Database Prefix: wp_ Total Database Size: 18.49MB Database Data Size: 14.81MB Database Index Size: 3.68MB wp_woocommerce_sessions: Data: 4.02MB + Index: 0.13MB + Engine InnoDB wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_order_itemmeta: Data: 0.08MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_actions: Data: 0.11MB + Index: 0.13MB + Engine InnoDB wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_logs: Data: 0.08MB + Index: 0.09MB + Engine InnoDB wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_comments: Data: 0.08MB + Index: 0.09MB + Engine InnoDB wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_nm_personalized: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_options: Data: 4.02MB + Index: 0.08MB + Engine InnoDB wp_postmeta: Data: 1.30MB + Index: 0.38MB + Engine InnoDB wp_posts: Data: 0.50MB + Index: 0.13MB + Engine InnoDB wp_psninja_amdd: Data: 3.30MB + Index: 1.32MB + Engine MyISAM wp_psninja_amdd_cache: Data: 0.02MB + Index: 0.00MB + Engine MyISAM wp_psninja_urls: Data: 0.05MB + Index: 0.00MB + Engine InnoDB wp_smush_dir_images: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_usermeta: Data: 0.06MB + Index: 0.03MB + Engine InnoDB wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_admin_notes: Data: 0.06MB + Index: 0.00MB + Engine InnoDB wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wfpklist_template_data: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpforms_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpmailsmtp_debug_events: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpmailsmtp_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_yoast_indexable: Data: 0.22MB + Index: 0.13MB + Engine InnoDB wp_yoast_indexable_hierarchy: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_yoast_migrations: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_yoast_primary_term: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_yoast_seo_links: Data: 0.05MB + Index: 0.03MB + Engine InnoDB wp_yoast_seo_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB ### Post Type Counts ### attachment: 108 custom_css: 2 nav_menu_item: 9 oembed_cache: 1 page: 17 post: 15 product: 13 product_variation: 12 quadro_mods: 127 revision: 204 shop_coupon: 3 shop_order: 23 shop_order_refund: 4 simple_testimonials: 1 wcpa_pt_forms: 1 wpcf7_contact_form: 1 ### Security ### Secure connection (HTTPS): ? Hide errors from visitors: ? ### Active Plugins (18) ### Amount Left for Free Shipping for WooCommerce: by WPFactory – 2.0.8 Autoptimize: by Frank Goossens (futtta) – 2.9.2 Contact Form 7: by Takayuki Miyoshi – 5.4.2 Disable Comments RB: by rbPlugins – 1.0.14 GA Google Analytics: by Jeff Starr – 20210719 Jetpack: by Automattic – 10.1 WooCommerce PDF Invoices, Packing Slips, Delivery Notes & Shipping Labels: by WebToffee – 2.8.3 PageSpeed Ninja: by PageSpeed Ninja – 0.9.43 USPS Simple Shipping for Woocommerce: by dangoodman – 1.5.6 WooCommerce Menu Cart: by Jeremiah Prummer Ewout Fernhout – 2.10.0 WooCommerce Payments: by Automattic – 3.0.0 (update to version 3.1.0 is available) PPOM for WooCommerce by N-MEDIA: by Najeeb Ahmad – 23.4 WooCommerce Shipping & Tax: by WooCommerce – 1.25.18 WooCommerce: by Automattic – 5.7.1 (update to version 5.8.0 is available) Yoast SEO: by Team Yoast – 17.2 WP Mail SMTP: by WPForms – 3.0.3 Smush: by WPMU DEV – 3.9.0 WPForms Lite: by WPForms – 1.6.9 ### Inactive Plugins (6) ### Akismet Anti-Spam: by Automattic – 4.1.12 All-in-One WP Migration: by ServMask – 7.48 Classic Editor: by WordPress Contributors – 1.6.2 Smart 404: by Michael Tyson – 0.6 W3 Total Cache: by BoldGrid – 2.1.8 WordPress Importer: by wordpressdotorg – 0.7 ### Dropin Plugins (1) ### advanced-cache.php: advanced-cache.php ### Settings ### API Enabled: – Force SSL: – Currency: USD ($) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: external (external) grouped (grouped) simple (simple) variable (variable) Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) Connected to WooCommerce.com: – ### WC Pages ### Shop base: #3231 - /shop/ Cart: #3232 - /cart/ Checkout: #3233 - /checkout/ My account: #3234 - /my-account/ Terms and conditions: ? Page not set ### Theme ### Name: Pepper Version: 1.2.6 Author URL: https://artisanthemes.io Child Theme: ? – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme WooCommerce Support: ? Not declared ### Templates ### Overrides: pepper/content-single-product.php ### Action Scheduler ### Complete: 245 Oldest: 2021-09-13 10:17:04 -0400 Newest: 2021-10-13 11:12:08 -0400 Failed: 6 Oldest: 2021-06-18 01:34:09 -0400 Newest: 2021-09-26 18:36:04 -0400 Pending: 5 Oldest: 2021-10-13 13:36:51 -0400 Newest: 2021-10-17 01:02:43 -0400 ### Status report information ### Generated at: 2021-10-13 11:12:10 -04:00
@writelizwrite Could you check it’s not a conflict with the PageSpeed Ninja plugin? Try to disable PSN plugin and test how website works. I see you use the Ultra settings preset that may conflict with some extensions (in particular, there is an “Optimize integrations (Facebook. Google Plus, etc.)” setting that postpones loading of all JavaScript on the page and rarely results in conflicts with 3rdparty JavaScripts).
@dryabov makes a good suggestion! Doing a conflict test is a good idea: https://docs.woocommerce.com/document/how-to-test-for-conflicts/
- Temporarily switch your theme to Storefront
- Disable all plugins except for WooCommerce
- Repeat the action that is causing the problem
This is best done on a staging site. That’s a copy of your live site, so you can test things out without making changes to your actual site. Some hosting companies offer a staging site service within their hosting plans. If yours does not, there is a great free plugin that will allow you to build a complete staging site with a few button clicks: https://www.ads-software.com/plugins/wp-staging.
If you’re not seeing the same problem after completing the conflict test, then you know the problem was with the plugins and/or theme you deactivated. To figure out which plugin is causing the problem, reactivate your other plugins one by one, testing after each, until you find the one causing conflict. You can find a more detailed explanation on how to do a conflict test here.
@dryabov You were spot on. It was PageSpeed Ninja. Unfortunately I totally missed your comment and discovered it via the suggestion from @imazed of a conflict test. I finally got around to creating a staging site, disabled plugins one at a time and voila. Came back here to share the result, saw your comment, and was able to confirm that it was the “Optimize Integrations” setting (under Minify JavaScript). Thank you both!
So happy to hear that you were able to pin down the conflicting plugin!
Often times issues arise due to conflicting plugins or an incompatible theme, so it’s always a good idea to switch the theme to Storefront and perform a conflict test to check if the problem/error goes away. ??
I’ll mark this thread as resolved. Feel free to open a new thread if you have more questions!??
Seeing a similar issue. Caching plugins have been disabled and I am having issues whether logged in or not. Here is the error I am seeing in the JS console:
jquery.min.js?ver=3.6.0:2 Uncaught ReferenceError: wc is not defined at L (upe_checkout.js?ver=3.6.1:1:81463) at HTMLDocument.<anonymous> (upe_checkout.js?ver=3.6.1:1:94594) at e (jquery.min.js?ver=3.6.0:2:30038) at t (jquery.min.js?ver=3.6.0:2:30340)
Not sure why the variable isn’t available here. Any ideas?
I was testing with twentytwentytwo which wasn’t working, but just tested twentytwentyone and now it is. After doing some digging, looks like this could happen if
add_theme_support( 'woocommerce' );
isn’t declared by the theme. Once this is included it fixes everything.- This reply was modified 2 years, 9 months ago by Kevin.
Hi @truheart
I was testing with twentytwentytwo which wasn’t working, but just tested twentytwentyone and now it is. After doing some digging, looks like this could happen if add_theme_support( ‘woocommerce’ ); isn’t declared by the theme. Once this is included it fixes everything.
Thanks for sharing your finding!
Surely this will help others who come across this thread.
If you have any other questions, do not hesitate to create a separate forum post, we’re happy to answer ??
Hi @solstudioim,
So I spotted one more issue and since it’s related to the OP I figured I would include it here. The credit card fields also don’t show if the checkout is being displayed via a shortcode on a page template other than the checkout template. This looks due to the
is_checkout()
requirement. If the checkout is being displayed via shortcode, and that shortcode is not included within thepost_content
, it won’t display.
- The topic ‘Credit card fields intermittently disappear from checkout page’ is closed to new replies.