endless spinning disc on checkout page with payment gateway filter applied
-
Hello,
I am using Gravity Forms with Woocommerce. I set the parameters in gravity forms to forward the gravity forms entry id as part of the URL ( e.g. https://www.niester.net/checkout/?entry_id=128 )
I am then using the “woocommerce_available_payment_gateways” filter to apply a transformation to the available gateways based on the data from the specific gravity forms entry id.
Everything works great until I enter the following line of code:
$dif_gf_entry_finaid = $dif_gf_entry['30'];
If I leave that ONE line commented out I don’t get the spinning disc. As soon as I include that line of code I get the spinning disc forever
I’m at a loss and would love any and all help that this community can provide. For reference here is my complete snippet code:
add_filter( 'woocommerce_available_payment_gateways', 'dif_unset_gateway_by_aid' ); function dif_unset_gateway_by_aid( $available_gateways ) { if ( is_admin() ) return $available_gateways; if ( ! is_checkout() ) return $available_gateways; // set unset to true so we remove the check option by default from all types of carts $unset = true; // get form and entry id of submitted form from query headers $dif_gf_entry_id = $_GET['entry_id']; $dif_gf_form_id = $_GET['form_id']; // retrieve Gravity Forms Entry associated with cart $dif_gf_entry = GFAPI::get_entry( $dif_gf_entry_id ); print_r($dif_gf_entry); // retrieve value of financial aid requested "Yes" or "No" echo "FIN AID REQ?: "; $fin_aid_key = '30'; $dif_gf_entry_finaid = $dif_gf_entry['30']; if ($dif_gf_entry_finaid === "Yes") $unset = false; // check unset credit card variable ($unset) and if true unset cheque. this is the default status. if ( $unset == true ) unset( $available_gateways['cheque'] ); if ( $unset == false ) unset( $available_gateways['stripe']); return $available_gateways; }
The page I need help with: [log in to see the link]
- The topic ‘endless spinning disc on checkout page with payment gateway filter applied’ is closed to new replies.