Home › Forums › Ticket Products › Event Tickets Plus › Display WooCommerce Product Content in Emailed Ticket
- This topic has 4 replies, 3 voices, and was last updated 9 years, 1 month ago by
Joshua.
-
AuthorPosts
-
March 23, 2017 at 4:00 pm #1259196
Joshua
ParticipantI have successfully created a template in my theme for ticketing emails at
/tribe-events/tickets/email.php. However, I would like to be able to display in this email thepost_contentfrom the WooCommerceproductassociated with this ticket.I am new to both WooCommerce and Event Tickets Plus. Any direction you can offer in making this happen would be greatly appreciated. Thank you!
March 23, 2017 at 5:33 pm #1259227Barry
MemberHi Joshua,
We are limited in terms of how much we can help with custom dev work like this but I’d be happy to point you in the right direction if I can 🙂
Within the template you referenced, you should have access to $ticket[‘ticket_id’]. In the context of WooCommerce-based tickets, you should be able to use this to obtain the matching product ID with some code like this (note that, you would need to do this from within the main foreach loop in that template):
$product_id = get_post_meta( $ticket['ticket_id'], '_tribe_wooticket_product', true );
Equipped with the product ID, you can then do:
echo apply_filters( 'the_content', get_post( $product_id )->post_content );
Or whatever makes sense in your situation. Does that help at all?
March 23, 2017 at 5:43 pm #1259232Joshua
ParticipantBarry, thank you for your response. This is helpful. I was wondering what meta connection might be there and didn’t have much time to track it down. After viewing a few other threads, I realized that you would probably be limited on offering custom solutions, so I did sort out another avenue for this and will share here, should anyone else have interest.
I noticed that I did have access to the $event object in that template and figured that content for the ticket might just as well reside in this event post, as well. So, using the Carbon Fields plugin, I created a custom meta field for the event and called that from the template … using wpautop to add the proper tags.
Thank you again! Super happy with this product. I’ve had to throw a quick solution together for a client and it’s come together well alongside WooCommerce.
March 23, 2017 at 8:39 pm #1259291Barry
MemberGlad to hear it and thanks for sharing your alternative — we’re always stoked to see things like this as we know it can be a great help for others researching issues like this in the future.
I’ll go ahead and close this topic, but of course please don’t hesitate to post new topics if anything else crops up and one of the team will be only too happy to assist 🙂
-
AuthorPosts
- The topic ‘Display WooCommerce Product Content in Emailed Ticket’ is closed to new replies.
