impress-org / givewp-snippet-library

A collection of code snippets to enhance or expand on the free Give WordPress Donation Plugin.
https://givewp.com
140 stars 90 forks source link

Auto Opt-in Fee Recovery Causing Errors in 2.18.1 #135

Open njsortor opened 2 years ago

njsortor commented 2 years ago

User Story

After updating my GiveWP plugins to the latest versions, the snippet check-optin-automatically.php causes an error which prevents the user from choosing a donation amount other than the default amount. The buttons become unclickable.

I did not have this issue with the snippet prior to updating to Give's latest version.

Details

ERROR: Uncaught TypeError: Cannot read properties of null (reading 'replace')

WARNING: jquery.min.js?ver=3.6.0:2 jQuery.Deferred exception: Cannot read properties of null (reading 'replace') TypeError: Cannot read properties of null (reading 'replace')

Visuals

Screen Shot 2022-02-07 at 5 46 09 PM

Additional Context

The problem also occurs on another one of my websites that is not using running on Wordpress Multisite as this example is.

System Information

Details ### WordPress Environment ### Home URL: https://campaign.run/cooperrider Site URL: http://campaign.run/cooperrider WP Version: 5.9 WP Multisite: ✔ WP Memory Limit: 3 GB WP Debug Mode: – WP Cron: ✔ Language: en_US Permalink Structure: /%postname%/ Show on Front: page Page on Front: Donate (#138) Page for Posts: Blog (#32) Table Prefix Length: fuq_2_ Table Prefix Length: 6 Table Prefix Status: Acceptable Admin AJAX: Accessible Registered Post Statuses: publish, future, draft, pending, private, trash, auto-draft, inherit, request-pending, request-confirmed, request-failed, request-completed, wc-pending, wc-processing, wc-on-hold, wc-completed, wc-cancelled, wc-refunded, wc-failed, refunded, failed, revoked, cancelled, abandoned, processing, preapproval, dp-rewrite-republish, aw-disabled, give_subscription ### Server Environment ### Hosting Provider: Siteground TLS Connection: Connection uses TLS 1.3 TLS Connection: Probably Okay Server Info: Apache PHP Version: 7.4.27 PHP Post Max Size: 256 MB PHP Time Limit: 120 PHP Max Input Vars: 3000 PHP Max Upload Size: 15 MB cURL Version: 7.66.0, OpenSSL/1.1.1l-fips SUHOSIN Installed: – MySQL Version: 5.7.32 Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ gzip: ✔ GD Graphics Library: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### GiveWP Configuration ### GiveWP Version: 2.18.1 GiveWP Cache: Enabled Database Updates: 8 updates still need to run. (Paused) Database Updates: All Database Migrations Completed. Database Tables: ✔ fuq_2_give_donors✔ fuq_2_give_donormeta✔ fuq_2_give_comments✔ fuq_2_give_commentmeta✔ fuq_2_give_sessions✔ fuq_2_give_formmeta✔ fuq_2_give_sequential_ordering✔ fuq_2_give_paymentmeta✔ fuq_2_give_revenue GiveWP Cache: Enabled GiveWP Cache: ✔New Donation✔Donation Receipt❌New Offline Donation❌Offline Donation Instructions✔New User Registration✔User Registration Information✔Donation Note✔Email access❌Renewal Receipt Email✔Admin Renewal Receipt Email✔Subscription Cancelled Email✔Admin Subscription Cancelled Email❌Subscription Completed Email❌Subscription Reminder Email✔Subscriptions Email Access✔Subscription Payment Failed Email Upgraded From: 2.17.0 Test Mode: Disabled Currency Code: USD Currency Position: Before Decimal Separator: . Thousands Separator: , Success Page: https://campaign.run/cooperrider/donation-confirmation/ Failure Page: https://campaign.run/cooperrider/donation-failed/ Donation History Page: https://campaign.run/cooperrider/donor-dashboard/ GiveWP Forms Slug: /donations/ Enabled Payment Gateways: Stripe - Credit Card Default Payment Gateway: Stripe - Credit Card PayPal IPN Notifications: N/A Donor Email Access: Enabled Stripe Webhook Notifications: February 7, 2022 7:26 pm ### Active GiveWP Add-ons ### Give - Database HealthCheck: ❌ Unlicensed – by WordImpress – 0.0.4 Give - Fee Recovery: ✔ Licensed – by GiveWP – 1.9.6 Give - Form Field Manager: ✔ Licensed – by GiveWP – 2.0.2 Give - Google Analytics Donation Tracking: ✔ Licensed – by GiveWP – 1.2.5 Give - Manual Donations: ✔ Licensed – by GiveWP – 1.6.0 Give - Pixel Tracking: ❌ Unlicensed – by GiveWP – 1.0.1 Give - Recurring Donations: ✔ Licensed – by GiveWP – 1.14.1 Give - Stripe Gateway: ✔ Licensed – by GiveWP – 2.4.1 Give - Zapier: ✔ Licensed – by GiveWP – 1.4.0 ### Other Active Plugins ### AutomateWoo: by WooCommerce – 5.4.1 BeCustom: by Muffin Group – 1.0.3 Branda Pro: by WPMU DEV – 3.4.5.1 Cart Reports for WooCommerce: by WooCommerce – 1.2.10 Code Snippets: by Code Snippets Pro – 2.14.2 Elementor: by Elementor.com – 3.4.8 Elementor Pro: by Elementor.com – 3.5.1 Facebook Chat Plugin - Live Chat Plugin for WordPress: by Facebook – 2.2 Facebook for WooCommerce: by Facebook – 2.6.7 Facebook for WordPress: by Facebook – 3.0.6 Fluent Connect: by wpmanageninja – 0.2 FluentCRM - Marketing Automation For WordPress: by Fluent CRM – 2.3.1 FluentCRM Pro: by Fluent CRM – 2.3.1 Fluent Forms: by Contact Form - WPManageNinja LLC – 4.2.21 FluentSMTP: by FluentSMTP & WPManageNinja Team – 2.1.0 Force Regenerate Thumbnails: by Pedro Elsner – 2.0.6 Gravity Forms: by Gravity Forms – 2.5.7 Health Check & Troubleshooting: by The WordPress.org community – 1.4.5 Hotjar: by Hotjar – 1.0.12 LayerSlider WP: by Kreatura Media – 6.11.9 Members: by MemberPress – 3.1.6 NS Cloner - Site Copier: by Never Settle – 4.1.8 Orbit Fox Companion: by Themeisle – 2.10.8 Plugins Garbage Collector (Database Cleanup): by Vladimir Garagulya – 0.12 Printify Shipping Method: by Printify – 2.5 Site Kit by Google: by Google – 1.45.0 Slider Revolution: by ThemePunch – 6.5.8 Under Construction: by WebFactory Ltd – 3.89 What The File: by Never5 – 1.5.4 WooCommerce: by Automattic – 5.9.0 WooCommerce Cart Add-Ons: by WooCommerce – 2.0.0 WooCommerce Checkout Add-Ons: by SkyVerge – 2.5.4 WooCommerce Checkout Field Editor: by WooCommerce – 1.6.1 WooCommerce Conversion Tracking: by weDevs – 2.0.9 WooCommerce Conversion Tracking Pro: by weDevs – 1.0.6 WooCommerce Coupon Campaigns & Tracking: by WooCommerce – 1.1.17 WooCommerce Store Credit: by Themesquad – 3.6.1 WooCommerce Stripe Gateway: by WooCommerce – 5.7.0 WPMU DEV Dashboard: by WPMU DEV – 4.11.8 Yoast Duplicate Post: by Enrico Battocchi & Team Yoast – 4.1.2 Yoast SEO: by Team Yoast – 17.5 ### Inactive Plugins ### 301 Redirects: by WebFactory Ltd – 2.72 Advanced Custom Fields PRO: by Delicious Brains – 5.10.2 All in One SEO: by All in One SEO Team – 4.1.5.3 BeTheme Header Builder: by Muffin group – 1.0.7.3 Change wp-admin login: by Nuno Morais Sarmento – 1.0.6 Contact Form 7: by Takayuki Miyoshi – 5.5.2 Droit Dark Mode: by DroitThemes – 1.0.5 Droit Elementor Addons: by DroitThemes – 3.0.0 Droit Elementor Templating: by DroitThemes – 1.0.0 Duplicator: by Snap Creek – 1.4.3 Essential Addons for Elementor: by WPDeveloper – 4.9.6 Favicon by RealFaviconGenerator: by Philippe Bernard – 1.3.22 ForumWP: by ForumWP – 2.0.2 ForumWP - Pro: by ForumWP – 1.0.1 Gravity Forms Survey Add-On: by Gravity Forms – 3.7 Gravity Forms User Registration Add-On: by Gravity Forms – 4.8 Jetpack: by Automattic – 10.3 Lordicon Animated Icons: by Lordicon – 2.0.1 MailPoet 3 (New): by MailPoet – 3.73.2 MailPoet 3 Premium (New): by MailPoet – 3.72.0 Multi-Step Checkout for WooCommerce: by SilkyPress – 2.18 Newsletter: by Stefano Lissa & The Newsletter Team – 7.3.1 One Click Demo Import: by OCDI – 3.0.2 Redux: by Extendify – 4.3.2 Saasland Core: by DroitThemes – 4.0 Salient Core: by ThemeNectar – 1.8.2 Salient Demo Importer: by ThemeNectar – 1.3 Salient Home Slider: by ThemeNectar – 1.4 Salient Nectar Slider: by ThemeNectar – 1.7 Salient Portfolio: by ThemeNectar – 1.7 Salient Shortcodes: by ThemeNectar – 1.5 Salient Social: by ThemeNectar – 1.2 Salient Widgets: by ThemeNectar – 1.2 SiteGround Central: by SiteGround – 2.0.0 SiteGround Optimizer: by SiteGround – 6.0.3 SiteGround Security: by SiteGround – 1.1.3 Support Board: by Schiocco – 3.0.8 Templates Patterns Collection: by ThemeIsle – 1.1.18 Ultimate Member: by Ultimate Member – 2.2.5 Ultimate Member - ForumWP: by Ultimate Member – 2.1.3 User Profile Picture: by Cozmoslabs – 2.6.0 User Role Editor: by Vladimir Garagulya – 4.60.2 WooCommerce Shipping & Tax: by WooCommerce – 1.25.20 WPBakery Page Builder: by Michael M - WPBakery.com – 6.7.0 WP Cerber Security, Anti-spam & Malware Scan: by Cerber Tech Inc. – 8.9.3 WP Mail SMTP: by WPForms – 3.2.0 WP REST API Controller: by YIKES, Inc. – 2.0.7 ### Active MU Plugins ### Health Check Troubleshooting Mode: by – 1.7.2 ### Theme ### Name: Betheme Version: 25.1.1 Author URL: https://muffingroup.com/ Child Theme: No – If you're modifying campaign.run on a parent theme you didn't build personally, then we recommend using a child theme. See: How to Create a Child Theme

Acceptance Criteria

The code snippet does not cause errors in the console or prevent users from selecting donation amounts when activated.