Home › Forums › Calendar Products › Events Calendar PRO › How to access original Event Page details using Woocommerce order details
- This topic has 6 replies, 2 voices, and was last updated 9 years ago by
robhadfield.
-
AuthorPosts
-
March 13, 2017 at 4:20 pm #1253588
robhadfield
ParticipantHi all!
I’m having issues getting to ACF fields on the event listing after purchase… let me explain…
I have an event page with Woocommerce tickets. After ordering I tap into the
mysite_woocommerce_order_status_completedhook to send some emails and save some data to a Google Spreadsheet.At this point i have access to all the purchase information, user name, payment etc etc but I want to access ACF field data from the event post itself.
Any idea how I can get there? I have the Woo Order ID and with this I can query for the Ticket ID (order_item_id) but still no closer to getting the original Event ID so I can access the ACF fields…
Hope this makes sense!
Cheers
RobMarch 15, 2017 at 12:58 am #1254269Hunter
ModeratorHey Rob,
Would you mind reviewing our Events Calendar PRO WordPress post meta data to see if the information you need is there? Another good resource is our Functions Archive, so check that as well.
Have you searched our forums to see if any threads lead you to the right information? I know this is probably an obvious statement, but events are stored as tribe_events post_type and the post_id in the ID column in your MySQL database.
Please keep me updated and we’ll continue investigating possible solutions. Cheers!
March 15, 2017 at 2:11 am #1254297robhadfield
ParticipantHi Hunter, thanks for that. The issue I have is that all those functions etc require me to have the Event ID and I don’t have this.
As an example:
The Event Post ID I want to get is 3359
The Woo OrderID I have is 4840So I select the Woo order details…
SELECT * FROM wp_woocommerce_order_items WHERE order_id = 4840
This returns order_item_id = 359 which is the Ticket IDUsing the ticket ID I can query for the ticket meta
SELECT * FROM wp_woocommerce_order_itemmeta WHERE order_item_id = 359
This returns the meta including a _product_id which is 3470I was hoping to see the Event ID in this result but it isn’t there… where is it? I’ve searched the whole of the tables wp_woocommerce_order_items && wp_woocommerce_order_itemmeta for ‘3359’ but I can’t see it…
Hoping this is clear enough, it’s starting to fry my brain!
Cheers 🙂
Rob-
This reply was modified 9 years, 1 month ago by
robhadfield.
March 15, 2017 at 2:29 am #1254306robhadfield
ParticipantUsing the Ticket ID can I see what Event has this ticket attached?
March 15, 2017 at 5:24 pm #1254820Hunter
ModeratorYou could use tribe_events_get_ticket_event(). For example, if the product or ticket ID is 123, and it belongs to event 456, then:
echo tribe_events_get_ticket_event( 123 ); // := 456You can also check out the logic in Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_event_for_ticket() if you need more insight there.
I hope this helps! Cheers 🙂
April 6, 2017 at 9:35 am #1266018Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
This reply was modified 9 years, 1 month ago by
-
AuthorPosts
- The topic ‘How to access original Event Page details using Woocommerce order details’ is closed to new replies.
