Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/c1a088d28d1e4abc24ec860baa911366 to your computer and use it in GitHub Desktop.
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
<?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