Home › Forums › Ticket Products › Event Tickets Plus › Add venue name and address to WooCommerce completed order email
- This topic has 8 replies, 3 voices, and was last updated 10 years ago by
Barry.
-
AuthorPosts
-
March 19, 2016 at 9:59 pm #1091493
anywherefest
ParticipantHi Team
I don’t want the Ticket Plus email and have used the relevant code in my functions.php to stop it but I DO want to include the venue address in the completed order email sent by WooCommerce…is there a way I can do this?
Thanks so much!
March 19, 2016 at 10:37 pm #1091495anywherefest
Participant…Even just adding the Ticket description (I have the address in there) into WooCommerce’s email-order-items.php would do…though venue hook would be better…
Many thanks!
March 21, 2016 at 9:53 am #1091872Josh
ParticipantHey Alex,
Thanks for reaching out to us!
There are a couple of pieces of information that we’ll need in order to get the venue for the associated event so you can update that email template.
- To start, we’ll need to get the event associated with the ticket product. You can grab this using the “_tribe_wooticket_for_event” meta key from the product in the email.
- Now that you’ve got the event ID, you can get the venue name for that event using tribe_get_venue
This can all be done within your theme’s functions.php and then be added to the email using the “woocommerce_order_item_meta_end” hook.
Let me know if this helps.
Thanks!
April 2, 2016 at 4:05 pm #1097496anywherefest
ParticipantHi Josh
Thanks so much for your reply. I really appreciate it. Unfortunately I am not savvy enough to quite grasp your answer…any further clues gratefully received!
April 5, 2016 at 7:09 pm #1098742Barry
MemberHi Alex,
Sorry for the delay.
You could definitely use the woocommerce_order_item_meta_end hook as Josh suggested but if you’re not comfortable with that approach it may be easier for you to instead override WooCommerce’s email-order-items.php template.
Apart from potentially being easier, this approach has the added benefit of targeting only the order email which is the area you are specifically interested in customizing (whereas the above hook is used in a few other places besides the email). To learn more about the process of actually overriding WooCommerce templates, though, you would really have to refer to their own documentation – but in outline you would copy:
plugins/woocommerce/templates/emails/email-order-items.php
To:
themes/YOUR_THEME/woocommerce/emails/email-order-items.php
Of course, swap YOUR_THEME with whatever the correct path is in your case. With that done, you can safely customize the template. Next, locate the following chunk of code (same file):
// File URLs if ( $show_download_links ) { $order->display_item_downloads( $item ); }Either above or below this, depending on where you want to see the address, you could add a snippet like this:
$event = tribe_events_get_ticket_event( $_product->id ); echo tribe_get_address( $event );
Does that help at all here? You’d probably need to do a few other tweaks to really make it fit nicely but this should give you the general idea.
Remember also that if you get really stuck with customizations like this one there are various folks you can hire (though of course we’ll be happy to try and point you in the right direction first of all) 🙂
April 5, 2016 at 9:08 pm #1098759anywherefest
ParticipantHi Barry
Thanks so much for verifying it can be done int he order items email of woocommerce! This is my definitely my preferred option as I have made several other tweaks this way and I can keep track of them better.
Your answer seems so good- too good to be true. WooCommerce even has space there for tweaks such as these but unfortunately that snippet doesn’t work- it doesn’t appear to be pulling in any venue information at all. If anyone can offer a clue to how I can get it to work I’d be most grateful!
April 6, 2016 at 7:58 am #1098933Barry
MemberHi Alex,
You’re right. Theoretically it ought to have worked as it was, but please see the updated code (note the addition of ->id in the first line) and give that a try instead.
This should grab the address for the venue, if set, or else for ordinary products (if you are selling things besides tickets) it should essentially do nothing.
I hope that helps!
April 6, 2016 at 2:56 pm #1099221anywherefest
ParticipantYou. Are. A. Genius.
Thank you!
April 6, 2016 at 3:13 pm #1099247Barry
MemberHappy to help 🙂
I’ll go ahead and close this topic – but of course should anything else crop up please don’t hesitate to create a new one and one of the team will be only too happy to help.
-
AuthorPosts
- The topic ‘Add venue name and address to WooCommerce completed order email’ is closed to new replies.
