Support

Home Forums Event Espresso Premium Ticket Price is not showing up in the UI when added by API

Ticket Price is not showing up in the UI when added by API

Posted: August 7, 2018 at 1:20 am

Viewing 8 reply threads


gncares

August 7, 2018 at 1:20 am

When I send this message:

{ "TKT_name": "Tuesday, August 14, 2018 from 12:14 AM to 1:14 AM", "TKT_start_date_gmt": "2018-08-14T00:14:16", "TKT_end_date_gmt": "2018-08-14T01:14:16", "TKT_price": "100.00", "TKT_qty": "20" }

I get the response back like this:

{"TKT_ID":121,"TKT_name":"Tuesday, August 14, 2018 from 12:14 AM to 1:14 AM","TKT_description":{"raw":"","rendered":""},"TKT_start_date":"2018-08-13T17:14:16","TKT_end_date":"2018-08-13T18:14:16","TKT_min":0,"TKT_max":-1,"TKT_price":{"raw":100,"pretty":"$100.00 <span class=\"currency-code\">(USD)<\/span>"},"TKT_sold":0,"TKT_qty":20,"TKT_reserved":0,"TKT_uses":-1,"TKT_required":false,"TKT_taxable":false,"TKT_is_default":false,"TKT_order":0,"TKT_row":0,"TKT_deleted":false,"TKT_parent":0,"TKT_start_date_gmt":"2018-08-14T00:14:16","TKT_end_date_gmt":"2018-08-14T01:14:16","_links":{"self":[{"href":"http:\/\/gncares.com\/wp-json\/ee\/v4.8.29\/tickets\/121"}],"collection":[{"href":"http:\/\/gncares.com\/wp-json\/ee\/v4.8.29\/tickets"}],"https:\/\/api.eventespresso.com\/datetimes":[{"href":"http:\/\/gncares.com\/wp-json\/ee\/v4.8.29\/tickets\/121\/datetimes","single":false}],"https:\/\/api.eventespresso.com\/datetime_tickets":[{"href":"http:\/\/gncares.com\/wp-json\/ee\/v4.8.29\/tickets\/121\/datetime_tickets","single":false}],"https:\/\/api.eventespresso.com\/prices":[{"href":"http:\/\/gncares.com\/wp-json\/ee\/v4.8.29\/tickets\/121\/prices","single":false}],"https:\/\/api.eventespresso.com\/ticket_template":[{"href":"http:\/\/gncares.com\/wp-json\/ee\/v4.8.29\/tickets\/121\/ticket_template","single":true}],"https:\/\/api.eventespresso.com\/registrations":[{"href":"http:\/\/gncares.com\/wp-json\/ee\/v4.8.29\/tickets\/121\/registrations","single":false}],"https:\/\/api.eventespresso.com\/wp_user":[{"href":"http:\/\/gncares.com\/wp-json\/ee\/v4.8.29\/tickets\/121\/wp_user","single":true}],"https:\/\/api.eventespresso.com\/extra_metas":[{"href":"http:\/\/gncares.com\/wp-json\/ee\/v4.8.29\/tickets\/121\/extra_metas","single":false}],"https:\/\/api.eventespresso.com\/change_logs":[{"href":"http:\/\/gncares.com\/wp-json\/ee\/v4.8.29\/tickets\/121\/change_logs","single":false}]}}

Which shows the price of $100, however, when I go to the WP site and view that Event, the price is empty. Everything else is in there, just not the price.

Am I missing something?


Josh

  • Support Staff

August 7, 2018 at 7:43 am

Yes you also need to send a POST request to the datetime_tickets endpoint and provide the TKT_ID (in this case 121) and the DTT_ID of the related datetime from the same event. It will be similar to this screenshot:

https://slack-files.com/T02SY781D-FBVT686AF-df3a4aba7d


gncares

August 7, 2018 at 2:56 pm

I guess I’m confused as to what the Date Time has to do with the Price of the Ticket?


Josh

  • Support Staff

August 7, 2018 at 3:09 pm

The datetime is what relates a ticket to an event. You’ve managed to create a ticket, give it a name and price and so on, but you haven’t connected it to a datetime yet. The ticket will only show up in the UI if it’s related/assigned to a datetime that’s related/assigned to an event.


gncares

August 7, 2018 at 5:02 pm

I have code that isn’t shown that does that, and all that works.

The problem is that the PRICE doesn’t show up in the UI. The Ticket is related to the correct event, it has the right name, dates, and quantity. The problem is that the PRICE doesn’t show up in the UI.

No way to attach a screen shot


Tony

  • Support Staff

August 8, 2018 at 5:40 am

No way to attach a screen shot

Sure there is, you just need to host the image and post the URL:

https://eventespresso.com/wiki/troubleshooting-checklist/#screenshots

However, I can reproduce and the reason this is happening is there is no price object for the ticket and no relationship within ticket_prices.

You need to create a price object with the relevant details (/prices/), then post to /ticket_prices/ to link the ticket with the price object, to do that you post the TKT_ID and PRC_ID (which you just created above).


gncares

August 8, 2018 at 10:13 am

Thanks, that’s the part I was missing. I’ll give it a try and let you know.


gncares

August 8, 2018 at 7:27 pm

That worked for me. Thank you.


Tony

  • Support Staff

August 9, 2018 at 1:56 am

You’re most welcome.

Just let us know if you run into any further problems.

Viewing 8 reply threads

The support post ‘Ticket Price is not showing up in the UI when added by API’ 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