I have a WooCommerce site with Gravity forms and a plugin called WooCommerce Gravity Forms Product Add-ons that allows me to add a Gravity Forms form to a product.
I would like to hide a woocommerce payment gateway based on the selection of one of the radio inputs in the Gravity Form that is on the product.
I know that the form is ID 1 and I know the field I'm interested in (a radio input) is field 8.
I have tried a number of things based on Gravity Forms documentation as well as documentation from the payment gateway and from StackOverflow posts.
// remove Partial.ly for hospice selection
add_action('gform_after_submission_1', 'get_hospice_info', 10, 2);
function get_hospice_info($entry, $form) {
$hospiceinfo = $entry['8'];
}
function hospice_selector_remove_partially($gateway) {
if ($hospiceinfo = "Yes, member under hospice or hospital care") {
$unset = true;
}
if ( $unset == true ) unset( $gateway['partially'] );
return $gateway;
} add_action('woocommerce_available_payment_gateways','hospice_selector_remove_partially');
I feel i'm close. But it is removing the gateway even when the other radio option is selected.
Any help would be greatly appreciated if possible.