Display WooCommerce Product Content in Emailed Ticket

Home Forums Ticket Products Event Tickets Plus Display WooCommerce Product Content in Emailed Ticket

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1259196
    Joshua
    Participant

    I 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 the post_content from the WooCommerce product associated 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!

    #1259227
    Barry
    Member

    Hi 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?

    #1259232
    Joshua
    Participant

    Barry, 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.

    #1259291
    Barry
    Member

    Glad 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 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Display WooCommerce Product Content in Emailed Ticket’ is closed to new replies.