Created
January 11, 2023 21:59
-
-
Save Pebblo/c1a088d28d1e4abc24ec860baa911366 to your computer and use it in GitHub Desktop.
Example of how to remove the State and Country fields from the Stripe payment method form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //Please do not include the opening PHP tag if you already have one | |
function tw_ee_remove_address_fields_from_stripe_billing_form( $options, $form ) { | |
if( $form instanceof EE_Billing_Attendee_Info_Form | |
&& isset( $options[ 'name' ] ) | |
&& $options[ 'name' ] === 'Stripe_Payment_Intent_and_Elements_Form' | |
) { | |
$fields_to_remove = array( | |
//'address', | |
//'address2', | |
//'city', | |
'state', | |
'country', | |
//'zip', | |
//'phone' | |
); | |
foreach( $fields_to_remove as $field ) { | |
unset( $options[ 'subsections' ][ $field ]); | |
} | |
} | |
return $options; | |
} | |
add_filter( 'FHEE__EE_Form_Section_Proper___construct__options_array', 'tw_ee_remove_address_fields_from_stripe_billing_form', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment