I’d like to modify the Square payment form in the Event Espresso pulugin. For example, the default form refers to a ZIP code but I would like it to refer to a (UK) post code. How are elements like these modified? Newbie here obvs.
I assume you simply want to change the field title on the billing form, correct ? And are you code savvy and/or have access to the website root, the wp-content/plugins directory ?
Because you can modify the titles for the Registration form Fields in WP Admin, but not the billing form fields. For that you would need to use the FHEE__EE_Form_Section_Proper___construct__options_array filter.
I would not recommend to modify any EE plugins directly, so I’ve created a quick code snipped for you to use as a separate plugin. You’ll have to simply create a new folder in the ../wp-contents/plugins directory, name it anything you’d like (event-espresso-mods for example), and create a new file in that folder (ee-mods.php for example) with the following contents:
<?php defined('ABSPATH') || exit('No direct script access allowed');
/*
Plugin Name: Modifications for Event Espresso
Description: Actions and filters that modify Event Espresso and/or their plugins.
Version: 1.0
*/
function staggersEEMods(): void
{
add_filter('FHEE__EE_Form_Section_Proper___construct__options_array', 'modifyEESquareBillingForm', 20, 2);
}
add_action('AHEE__EE_System__load_espresso_addons', 'staggersEEMods');
function modifyEESquareBillingForm($options_array, $form_section): array
{
// Make sure we edit only the Square billing form.
if (! empty($options_array['name'])
&& ! empty($options_array['subsections'])
&& $options_array['name'] === 'SquareOnsite_BillingForm' // remove this line if you want all forms to be edited
) {
$subsections = $options_array['subsections'];
// Edit the Zip code field.
if (! empty($subsections['zip'])) {
$updated_zip_field = $subsections['zip'];
$updated_zip_field->set_html_label_text(esc_html__('Postal code', 'event_espresso'));
$options_array['subsections']['zip'] = $updated_zip_field;
}
}
return $options_array;
}
Then activate this new “Modifications for Event Espresso” plugin in WP admin.
Please let me know if you need more help or if something from the above is not clear.
Viewing 1 reply thread
The support post ‘Can you modify the Square Payment form?’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.