{"id":1568634,"date":"2018-07-05T12:50:30","date_gmt":"2018-07-05T19:50:30","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-event-title-to-woocommerce-order-item-title\/"},"modified":"2018-07-05T12:50:30","modified_gmt":"2018-07-05T19:50:30","slug":"add-event-title-to-woocommerce-order-item-title","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-event-title-to-woocommerce-order-item-title\/","title":{"rendered":"Add event title to WooCommerce order item title"},"content":{"rendered":"<p>I&#8217;d like to add the event title to ticket order items. I&#8217;m currently using the following function, but it&#8217;s only outputting &#8221; &#8211; Upcoming Events&#8221;, not the actual event title.<\/p>\n<pre><code>function woocommerce_order_item_name_event_title( $title, $item ) {\n\t\t$event = tribe_events_get_ticket_event( $item[&#039;product_id&#039;] );\n\n\t\tif ( $event !== false ) {\n\t\t\t$title .= sprintf( &#039; - &lt;a href=&quot;%1$s&quot;&gt;%2$s&lt;\/a&gt;&#039;, get_permalink( $event ), tribe_get_events_title( $event ) );\n\t\t}\n\n\treturn $title;\n}\nadd_filter( &#039;woocommerce_order_item_name&#039;, &#039;woocommerce_order_item_name_event_title&#039;, 100, 2 );<\/code><\/pre>\n<p>If I try get_the_title, I only get the current page title, like &#8220;Order received&#8221; or &#8220;Order #&#8230;&#8221; if I&#8217;m on the view order page, so it&#8217;s not getting the event title based on the event id.<\/p>\n<p>Any help would be appreciated.<\/p>\n","protected":false},"template":"","class_list":["post-1568634","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Add event title to WooCommerce order item title -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-event-title-to-woocommerce-order-item-title\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Add event title to WooCommerce order item title -\" \/>\n<meta property=\"og:description\" content=\"I&#8217;d like to add the event title to ticket order items. I&#8217;m currently using the following function, but it&#8217;s only outputting &#8221; &#8211; Upcoming Events&#8221;, not the actual event title. function woocommerce_order_item_name_event_title( $title, $item ) { $event = tribe_events_get_ticket_event( $item[&#039;product_id&#039;] ); if ( $event !== false ) { $title .= sprintf( &#039; - &lt;a href=&quot;%1$s&quot;&gt;%2$s&lt;\/a&gt;&#039;, [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-event-title-to-woocommerce-order-item-title\/\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-event-title-to-woocommerce-order-item-title\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-event-title-to-woocommerce-order-item-title\/\",\"name\":\"Add event title to WooCommerce order item title -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2018-07-05T19:50:30+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-event-title-to-woocommerce-order-item-title\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-event-title-to-woocommerce-order-item-title\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-event-title-to-woocommerce-order-item-title\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Ticket Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Event Tickets Plus\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/event-tickets-plus\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Add event title to WooCommerce order item title\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Add event title to WooCommerce order item title -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-event-title-to-woocommerce-order-item-title\/","og_locale":"en_US","og_type":"article","og_title":"Add event title to WooCommerce order item title -","og_description":"I&#8217;d like to add the event title to ticket order items. I&#8217;m currently using the following function, but it&#8217;s only outputting &#8221; &#8211; Upcoming Events&#8221;, not the actual event title. function woocommerce_order_item_name_event_title( $title, $item ) { $event = tribe_events_get_ticket_event( $item[&#039;product_id&#039;] ); if ( $event !== false ) { $title .= sprintf( &#039; - &lt;a href=&quot;%1$s&quot;&gt;%2$s&lt;\/a&gt;&#039;, [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-event-title-to-woocommerce-order-item-title\/","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-event-title-to-woocommerce-order-item-title\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-event-title-to-woocommerce-order-item-title\/","name":"Add event title to WooCommerce order item title -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2018-07-05T19:50:30+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-event-title-to-woocommerce-order-item-title\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-event-title-to-woocommerce-order-item-title\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-event-title-to-woocommerce-order-item-title\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Ticket Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/"},{"@type":"ListItem","position":4,"name":"Event Tickets Plus","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/event-tickets-plus\/"},{"@type":"ListItem","position":5,"name":"Add event title to WooCommerce order item title"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1568634","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1568634\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1568634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}