Support

Home Forums Event Espresso Premium Prevent Credit Card Fields (First, Last Name, & Email)

Prevent Credit Card Fields (First, Last Name, & Email)

Posted: August 17, 2023 at 8:35 am

Viewing 7 reply threads


pathwise

August 17, 2023 at 8:35 am

Hello,

We created a third question group for Billing Info: https://snipboard.io/Tz6rYx.jpg

That is fine but we noticed that when the user selects credit card for the payment method, the Attendee 1 info is populated. https://snipboard.io/wXrKJU.jpg

Is it possible to have the billing info populated here OR just have it blank?

Thank you.


pathwise

August 17, 2023 at 8:37 am

Subject should read “Prevent Credit Card Fields from Populating”


Tony

  • Support Staff

August 17, 2023 at 3:24 pm

Hi there,

There’s a filter used for those values:

FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee

You can’t easily set the values to be from the registration questions but you can return an empty array to that filter to just have the fields blank.


pathwise

August 18, 2023 at 7:13 am

Thank you very much. I am going to try this!


pathwise

August 18, 2023 at 7:36 am

Hello Tony,

I put the following function and filter in my functions.php

   /**
     * Sets the defaults for the billing form according to the attendee's details
     *
     * @param EE_Attendee $attendee
     * @throws EE_Error
     * @throws ReflectionException
     */
    function populate_from_attendee(EE_Attendee $attendee)
    {
        /** @var $attendee EE_Attendee */
        $attendee = EEM_Attendee::instance()->ensure_is_obj($attendee);
        $this->populate_defaults(
            apply_filters(
                'FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee',
                [
                    'first_name' => '',
                    'last_name'  => '',
                    'email'      => '',
                    'address'    => '',
                    'address2'   => '',
                    'city'       => '',
                    'state'      => '',
                    'country'    => '',
                    'zip'        => '',
                    'phone'      => '',
                ],
                $attendee,
                $this
            )
        );
    }

I was thinking I should edit this directly in the EE core plugin files which is why I put in functions.php. The attendee’s info is still populating so I did something wrong, ha!

Any insight?

I appreciate your help.


pathwise

August 18, 2023 at 7:36 am

*I was thinking I shouldn’t edit this directly in the EE core plugin files.


Tony

  • Support Staff

August 18, 2023 at 7:39 am

🙂 yep, you need to USE the filter rather than copy it.

So you just need to remove the above and use something like this:

add_filter('FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee', '__return_empty_array', 20);


pathwise

August 18, 2023 at 8:30 am

Perfect. Thank you very much!

Viewing 7 reply threads

The support post ‘Prevent Credit Card Fields (First, Last Name, & Email)’ 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.

Event Espresso