Support

Home Forums Event Espresso Premium Get Ticket Price

Get Ticket Price

Posted: January 10, 2016 at 4:53 pm


hojati

January 10, 2016 at 4:53 pm

Hello Folks,

i want to display the price of the first ticket and got a code like this:

if ( $post->EE_Event instanceof EE_Event ) {
$ticket_array = $post->EE_Event->first_datetime()->tickets();
$first_ticket = array_shift($ticket_array);
$price = $first_ticket->price();
}

But this is without any tax and discouts. Is there a way to get the first price like it would be displayed by the ticket_selector? And can i get this price as a number?


Tony

  • Support Staff

January 11, 2016 at 6:35 am

Hi there,

I would highly recommend installing Kint if you don’t have it already.

You can then easily see all of the available methods on an object using
d(), for example:

d($first_ticket);

Outputs an easy to navigate display of all methods, properties and various info.

For a total including taxes you can use get_ticket_total_with_taxes().


hojati

January 12, 2016 at 2:18 pm

This is working good. Thanks.

The support post ‘Get Ticket Price’ 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