Be advised: I created a video which shows the issue. You can access it from my screencast account here.
The Issue
I am using the PayPal Checkout Add-On for donations. I have created and tested two different forms with a conditional field which states "Make this donation Monthly". The first form uses a checkbox, which causes a fatal error unless a highly non-intuitive approach is used. The second form is slightly more intuitive, and uses radio buttons but also flat out fails.
Be advised: I have conditional PayPal feeds, based on the “Make this donation Monthly” option for BOTH forms (Checkbox and Radio Buttons)
The causes of the failures are as follows: once the use enters an amount, the paypal field is displayed. However, IF -in the case of the the checkbox form- the user THEN checks "Make this donation Monthly" and so triggers the Subscription PayPal feed, the process ends with a Fatal Error.
If -in the case of the the radio button form- the user THEN selects "YES" for "Make this donation Monthly", and so triggers the Subscription PayPal feed, the process also ends with a Fatal Error.
Any Ideas? Thanks,
Preston
p.s. I also submitted this to support in case this is a bug.
What is the 500 Internal Server Error that is being logged (either in the web server error log, PHP error log, WP_DEBUG debug.log or in the email with the stack trace that WordPress will send to the website admin email address)?
Based on the video, here is the error message where I used the checkbox form.
[11-Oct-2021 19:20:03 UTC] PHP Warning: in_array() expects at least 2 parameters, 1 given in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/class-gf-ppcp.php on line 2379
[11-Oct-2021 19:20:14 UTC] PHP Warning: in_array() expects at least 2 parameters, 1 given in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/class-gf-ppcp.php on line 2379
[11-Oct-2021 19:20:35 UTC] PHP Notice: Undefined variable: subscriptions_model in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php on line 138
[11-Oct-2021 19:20:35 UTC] PHP Fatal error: Uncaught Error: Call to a member function load() on null in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php:138
Stack trace:
#0 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php(110): Gravity_Forms\Gravity_Forms_PPCP\PayPal_Subscriptions_Handler->create_subscription(Array, Array, Array, Array)
#1 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/class-gf-ppcp.php(3513): Gravity_Forms\Gravity_Forms_PPCP\PayPal_Subscriptions_Handler->initialize_subscription(Array, Array, Array, Array)
#2 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityforms/includes/addon/class-gf-payment-addon.php(638): GF_PPCP->subscribe(Array, Array, Array, Array)
#3 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityforms/includes/addon/class-gf-p in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php on line 138
[11-Oct-2021 19:20:56 UTC] PHP Warning: in_array() expects at least 2 parameters, 1 given in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/class-gf-ppcp.php on line 2379
Thank you for that. Checking the system report in your support ticket, you are using the PayPal Checkout version 2.0.3. The latest available is 2.2. Can you please try updating to that release and see if the issue persists?
[11-Oct-2021 20:09:14 UTC] PHP Notice: Undefined variable: subscriptions_model in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php on line 138
[11-Oct-2021 20:09:14 UTC] PHP Fatal error: Uncaught Error: Call to a member function load() on null in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php:138
Stack trace:
#0 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php(110): Gravity_Forms\Gravity_Forms_PPCP\PayPal_Subscriptions_Handler->create_subscription(Array, Array, Array, Array)
#1 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/class-gf-ppcp.php(3547): Gravity_Forms\Gravity_Forms_PPCP\PayPal_Subscriptions_Handler->initialize_subscription(Array, Array, Array, Array)
#2 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityforms/includes/addon/class-gf-payment-addon.php(638): GF_PPCP->subscribe(Array, Array, Array, Array)
#3 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityforms/includes/addon/class-gf-p in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php on line 138
Update: I received a message wherein support was initially unable to recreate the error. So I created another video wherein I successfully recreated the error, using Gravity Forms own demo site. Mainly, because this way I could eliminate any issues around my PC, Server, etc. Not using any of that.
Hi Preston and sadedar. I understand Samuel replied with a temporary workaround for the issue, and referred the issue to the product development team for a permanent fix. You will hear back on your tickets once we have a resolution from the product team. Thank you.
Actually, NO! This is NOT a workaround. I regret to say that after 11 days and two video walkthroughs it appears that, they do not even understand the problem i am reporting. So it begs the question as to what they are planning to “fix” with an update to the addon. Please see my THIRD video on this topic.
Thanks for all the additional information, it was very helpful and allowed me to replicate the issue importing your form and configuring the same feeds setup.
After doing some troubleshooting I found the issue it’s related somehow to the product type used and the field used for conditional logic of feeds.
I have reported this to the product team for getting it fixed in a new version of the add-on.
In the mean time, I found an easy workaround that you can use to make it work: