{"id":1130792,"date":"2016-06-23T00:20:26","date_gmt":"2016-06-23T07:20:26","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-woocommerce-product-id-via-tribe_get_events\/"},"modified":"2016-06-23T00:20:26","modified_gmt":"2016-06-23T07:20:26","slug":"getting-woocommerce-product-id-via-tribe_get_events","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-woocommerce-product-id-via-tribe_get_events\/","title":{"rendered":"Getting woocommerce product ID via tribe_get_events"},"content":{"rendered":"<p>Hi there&#8230; I&#8217;m trying to do a loop through all my events in a category, then output the start date along with the Woocommerce product ID for the associated ticket. I&#8217;m using Events Calendar Pro with Events Tickets Plus. What I&#8217;ve got so far works, but I don&#8217;t know how to get the ticket product ID for a given event.<\/p>\n<pre><code>&lt;?php\n              $events = tribe_get_events(array(\n                  &#039;tribe_events_cat&#039; =&gt; &#039;restaurant&#039;\n              ));\n              $start_date = date_format(date_create(get_post_meta($event-&gt;ID, &#039;_EventStartDate&#039;, true)),&quot;l F j&quot;);\n              $product_id = &#039;&#039; \/\/This should be the product ID of the ticket\n              if ( empty( $events ) ) {\n                  echo &#039;&lt;option&gt;No events found&lt;\/option&gt;&#039;;\n              }\n              else foreach( $events as $event ) {\n                echo &#039;&lt;option value=&quot;&#039;.$product_id.&#039;&quot;&gt;&#039;.$start_date.&#039;&lt;\/option&gt;&#039;;\n              }\n            ?&gt;<\/code><\/pre>\n<p>Hope that makes sense! Let me know if you need more info to help out.<\/p>\n","protected":false},"template":"","class_list":["post-1130792","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>Getting woocommerce product ID via tribe_get_events -<\/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\/getting-woocommerce-product-id-via-tribe_get_events\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Getting woocommerce product ID via tribe_get_events -\" \/>\n<meta property=\"og:description\" content=\"Hi there&#8230; I&#8217;m trying to do a loop through all my events in a category, then output the start date along with the Woocommerce product ID for the associated ticket. I&#8217;m using Events Calendar Pro with Events Tickets Plus. What I&#8217;ve got so far works, but I don&#8217;t know how to get the ticket product [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-woocommerce-product-id-via-tribe_get_events\/\" \/>\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\/getting-woocommerce-product-id-via-tribe_get_events\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-woocommerce-product-id-via-tribe_get_events\/\",\"name\":\"Getting woocommerce product ID via tribe_get_events -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2016-06-23T07:20:26+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-woocommerce-product-id-via-tribe_get_events\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-woocommerce-product-id-via-tribe_get_events\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-woocommerce-product-id-via-tribe_get_events\/#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\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Events Calendar PRO\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Getting woocommerce product ID via tribe_get_events\"}]},{\"@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":"Getting woocommerce product ID via tribe_get_events -","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\/getting-woocommerce-product-id-via-tribe_get_events\/","og_locale":"en_US","og_type":"article","og_title":"Getting woocommerce product ID via tribe_get_events -","og_description":"Hi there&#8230; I&#8217;m trying to do a loop through all my events in a category, then output the start date along with the Woocommerce product ID for the associated ticket. I&#8217;m using Events Calendar Pro with Events Tickets Plus. What I&#8217;ve got so far works, but I don&#8217;t know how to get the ticket product [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-woocommerce-product-id-via-tribe_get_events\/","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\/getting-woocommerce-product-id-via-tribe_get_events\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-woocommerce-product-id-via-tribe_get_events\/","name":"Getting woocommerce product ID via tribe_get_events -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2016-06-23T07:20:26+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-woocommerce-product-id-via-tribe_get_events\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-woocommerce-product-id-via-tribe_get_events\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-woocommerce-product-id-via-tribe_get_events\/#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":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Events Calendar PRO","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/"},{"@type":"ListItem","position":5,"name":"Getting woocommerce product ID via tribe_get_events"}]},{"@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\/1130792","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\/1130792\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1130792"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}