Support

Home Forums Event Espresso Premium Extending Event Espresso 4 (Custom fields)

Extending Event Espresso 4 (Custom fields)

Posted: January 6, 2015 at 9:06 am

Viewing 3 reply threads


Hector Alcala

January 6, 2015 at 9:06 am

Hi, I’m looking for documentation or everything related about extending Event Espresso 4. Once the registration is completed, I have to send a value, that is stored as a custom field at the event page, in a HTTP request. I’m trying to achieve this at the checkout page, once the payment gateway confirms then create the request.

But I need to be able to get the events details (custom fields) at the payment gateway. Is there a way to achieve this? In short, there’s a ID in a custom field that I have to be able of get it at the payment gateway.


Dean

January 7, 2015 at 6:23 am

Hi,

Well, it depends on where you are trying to do this, but here’s an example:

function customfield_thing($registration) {

  //get the event id from the $registration array (uses EE_Registration class)
  $id = $registration->event_ID();

  //make sure this is the Thank You page - CHANGE THE 6 TO THE PAGE ID!!!!
  if (is_page('6')) {
    //get the right meta field
    $y = get_post_meta( $id, 'metafieldkey', true);
    //do something with the meta field value
    echo $y;
  }
}

add_action('AHEE__thank_you_page_registration_details_template__after_registration_table_row','customfield_thing');

This will fire on the Thank You page (so after purchase), and grab a custom field from the event. This example will merely output the custom field value, but you could easily fire it off to the database or wherever.

The different Thank You page template files are found here /wp-content/plugins/event-espresso-core-reg_448/shortcodes/espresso_thank_you/templates in case you need to change the action hook.

If none of that makes sense, you will need to refer to a developer for assistance.

  • This reply was modified 9 years, 10 months ago by Dean. Reason: typos


Hector Alcala

January 7, 2015 at 9:49 pm

Thank you very much! It was the information I needed.


Dean

January 8, 2015 at 3:27 am

You’re welcome!

Viewing 3 reply threads

The support post ‘Extending Event Espresso 4 (Custom fields)’ 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