{"id":1964287,"date":"2025-02-20T11:04:00","date_gmt":"2025-02-20T16:04:00","guid":{"rendered":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/?p=1964287"},"modified":"2025-02-20T11:04:01","modified_gmt":"2025-02-20T16:04:01","slug":"extending-tickets-emails-placeholders","status":"publish","type":"post","link":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/extending-tickets-emails-placeholders\/","title":{"rendered":"Extending Tickets Emails Placeholders"},"content":{"rendered":"\n<p>When a customer purchases a ticket, various types of emails may be sent, including:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ticket Confirmation Email<\/li>\n\n\n\n<li>Completed Order Email<\/li>\n\n\n\n<li>Purchase Receipt<\/li>\n<\/ul>\n\n\n\n<p>When using <span style=\"text-decoration: underline;\"><a href=\"https:\/\/staging.theeventscalendar.com\/knowledgebase\/tickets-commerce\/\" target=\"_blank\" rel=\"noreferrer noopener\">Tickets Commerce<\/a><\/span> as the payment method, order emails and purchase receipts are handled by Tickets Commerce itself. Although email templates include placeholders, not all are available for every type of email. You can find more information about the different types of emails and the available placeholders for each one here.<\/p>\n\n\n\n<p><a href=\"https:\/\/staging.theeventscalendar.com\/knowledgebase\/event-tickets-emails\/\">Event Tickets Emails Knowledgebase<\/a><\/p>\n\n\n\n<p>By default, the Completed Order email from Tickets Commerce includes a limited set of placeholders and does not provide built-in support for adding custom placeholders such as the purchaser&#8217;s name or event title. However, one can extend this functionality with custom coding. This article provides a snippet that enables the use of <code>{purchaser_name}<\/code> and <code>{event_title}<\/code> placeholders in the Completed Order email.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-adding-custom-placeholders-to-completed-order-email\">Adding Custom Placeholders to Completed Order Email<\/h2>\n\n\n\n<p>Add the following PHP code to the site to be able to use <code>{event_title}<\/code> and <code>{purchaser_name}<\/code> placeholders in the Completed Order email,<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/masoodahmed\/0439670adce3b5ce109fdb9bb9768ab3.js\"><\/script>\n\n\n\n<p>Add the code snippet to the <em>functions.php<\/em> file of your theme, or use your preferred method for integrating snippets into your WordPress site, such as the free <a href=\"https:\/\/wordpress.org\/plugins\/code-snippets\/\" target=\"_blank\" rel=\"noreferrer noopener\">Code Snippets<\/a> plugin.<\/p>\n\n\n\n<p>The snippet retrieves attendee information from the email object. It obtains the name of the individual who made the purchase, along with the associated event ID. Using this event ID, the title of the event is then retrieved. These details are then added to the available placeholders in the email.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-for-developers\">For Developers<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span style=\"text-decoration: underline;\"><a href=\"https:\/\/docs.theeventscalendar.com\/reference\/hooks\/tec_tickets_emails_this-slug_placeholders\/\">tec_tickets_emails_completed-order_placeholders<\/a><\/span><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>When a customer purchases a ticket, various types of emails may be sent, including: When using Tickets Commerce as the payment method, order emails and purchase receipts are handled by Tickets Commerce itself. Although email templates include placeholders, not all are available for every type of email. You can find more information about the different&#8230;<\/p>\n","protected":false},"author":59,"featured_media":1955565,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_swpsp_post_exclude":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"ep_exclude_from_search":false,"footnotes":""},"categories":[24,59,79],"tags":[20,25,28,58,89],"stellar-product-taxonomy":[155],"class_list":["post-1964287","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-customizing","category-customizing-resources","category-snippets","tag-code","tag-customizations","tag-email","tag-php","tag-tickets-commerce","stellar-product-taxonomy-event-tickets"],"acf":[],"taxonomy_info":{"category":[{"value":24,"label":"Customizations"},{"value":59,"label":"PHP &amp; Functions"},{"value":79,"label":"Snippets"}],"post_tag":[{"value":20,"label":"Code"},{"value":25,"label":"Customizations"},{"value":28,"label":"Email"},{"value":58,"label":"PHP"},{"value":89,"label":"Tickets Commerce"}],"stellar-product-taxonomy":[{"value":155,"label":"Event Tickets"}]},"featured_image_src_large":["https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/02\/social-share-1024x538.png",1024,538,true],"author_info":{"display_name":"Masood","author_link":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/author\/masood\/"},"comment_info":0,"category_info":[{"term_id":24,"name":"Customizations","slug":"customizing","term_group":0,"term_taxonomy_id":24,"taxonomy":"category","description":"","parent":0,"count":110,"filter":"raw","term_order":"0","cat_ID":24,"category_count":110,"category_description":"","cat_name":"Customizations","category_nicename":"customizing","category_parent":0},{"term_id":59,"name":"PHP &amp; Functions","slug":"customizing-resources","term_group":0,"term_taxonomy_id":59,"taxonomy":"category","description":"","parent":24,"count":101,"filter":"raw","term_order":"0","cat_ID":59,"category_count":101,"category_description":"","cat_name":"PHP &amp; Functions","category_nicename":"customizing-resources","category_parent":24},{"term_id":79,"name":"Snippets","slug":"snippets","term_group":0,"term_taxonomy_id":79,"taxonomy":"category","description":"","parent":0,"count":136,"filter":"raw","term_order":"0","cat_ID":79,"category_count":136,"category_description":"","cat_name":"Snippets","category_nicename":"snippets","category_parent":0}],"tag_info":[{"term_id":20,"name":"Code","slug":"code","term_group":0,"term_taxonomy_id":20,"taxonomy":"post_tag","description":"","parent":0,"count":33,"filter":"raw","term_order":"0"},{"term_id":25,"name":"Customizations","slug":"customizations","term_group":0,"term_taxonomy_id":25,"taxonomy":"post_tag","description":"","parent":0,"count":177,"filter":"raw","term_order":"0"},{"term_id":28,"name":"Email","slug":"email","term_group":0,"term_taxonomy_id":28,"taxonomy":"post_tag","description":"","parent":0,"count":20,"filter":"raw","term_order":"0"},{"term_id":58,"name":"PHP","slug":"php","term_group":0,"term_taxonomy_id":58,"taxonomy":"post_tag","description":"","parent":20,"count":128,"filter":"raw","term_order":"0"},{"term_id":89,"name":"Tickets Commerce","slug":"tickets-commerce","term_group":0,"term_taxonomy_id":89,"taxonomy":"post_tag","description":"","parent":26,"count":26,"filter":"raw","term_order":"0"}],"_links":{"self":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1964287","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/users\/59"}],"replies":[{"embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=1964287"}],"version-history":[{"count":3,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1964287\/revisions"}],"predecessor-version":[{"id":1964296,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1964287\/revisions\/1964296"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media\/1955565"}],"wp:attachment":[{"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=1964287"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=1964287"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=1964287"},{"taxonomy":"stellar-product-taxonomy","embeddable":true,"href":"https:\/\/staging.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/stellar-product-taxonomy?post=1964287"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}