{"id":1560391,"date":"2018-06-24T19:02:51","date_gmt":"2018-06-25T02:02:51","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/display-only-tickets-on-sale\/"},"modified":"2018-06-24T19:02:51","modified_gmt":"2018-06-25T02:02:51","slug":"display-only-tickets-on-sale","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/display-only-tickets-on-sale\/","title":{"rendered":"Display only tickets on sale"},"content":{"rendered":"<p>I created a child template for tickets.php under wootickets as per your instructions to link directly to the product from an event&#8217;s page. <\/p>\n<p>I typically have an early bird ticket special and regular tickets. Early bird stays up for a few weeks and may not sell out before the next ticket then shows. <\/p>\n<p>I would like it so that if either or of the tickets are sold out it does NOT show the ticket amount. Right now I have a sold out event, literally has zero tickets left, yet it&#8217;s still showing the link to the product and the price. I haven&#8217;t been able to find a solution in your docs. Maybe I have to check for if global stock is not less than zero then show? <\/p>\n<pre><code>$count = 0;\necho &#039;&lt;ul&gt;&#039;;\nforeach ( $tickets as $ticket ) {\n\tglobal $product;\n\t$count++;\n\tif ( class_exists( &#039;WC_Product_Simple&#039; ) ) $product = new WC_Product_Simple( $ticket-&gt;ID );\n\telse $product = new WC_Product( $ticket-&gt;ID );\n\t$price = $product-&gt;get_price_html();\n\t$link = &#039;&lt;a href=&quot;&#039; . $product-&gt;get_permalink() . &#039;&quot;&gt;Buy now&lt;\/a&gt;&#039;;\n\t\n\t\t\n\t\tif ( tribe_events_ticket_is_on_sale( $ticket ) ) {\n\t\t\t\n\n\t\n\techo &quot;$price $link &lt;br&gt; $ticket-&gt;description  - [$ticket-&gt;stock] Available&quot;;\n\t\n\t} \n\t\n\t\n\t\n\t\n}\n\nif ( 0 === $count )\n\techo &#039;&lt;li&gt; There are no tickets available for this event &lt;\/li&gt;&#039;;\necho &#039;&lt;\/ul&gt;&#039;;\n<\/code><\/pre>\n<p>I know you guys always say &#8220;we can&#8217;t help with customization&#8221; but this is a snippet of code directly from your docs so any help would be great, thanks. <\/p>\n","protected":false},"template":"","class_list":["post-1560391","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>Display only tickets on sale -<\/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\/display-only-tickets-on-sale\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Display only tickets on sale -\" \/>\n<meta property=\"og:description\" content=\"I created a child template for tickets.php under wootickets as per your instructions to link directly to the product from an event&#8217;s page. I typically have an early bird ticket special and regular tickets. Early bird stays up for a few weeks and may not sell out before the next ticket then shows. I would [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/display-only-tickets-on-sale\/\" \/>\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\/display-only-tickets-on-sale\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/display-only-tickets-on-sale\/\",\"name\":\"Display only tickets on sale -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2018-06-25T02:02:51+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/display-only-tickets-on-sale\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/display-only-tickets-on-sale\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/display-only-tickets-on-sale\/#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\":\"Display only tickets on sale\"}]},{\"@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":"Display only tickets on sale -","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\/display-only-tickets-on-sale\/","og_locale":"en_US","og_type":"article","og_title":"Display only tickets on sale -","og_description":"I created a child template for tickets.php under wootickets as per your instructions to link directly to the product from an event&#8217;s page. I typically have an early bird ticket special and regular tickets. Early bird stays up for a few weeks and may not sell out before the next ticket then shows. I would [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/display-only-tickets-on-sale\/","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\/display-only-tickets-on-sale\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/display-only-tickets-on-sale\/","name":"Display only tickets on sale -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2018-06-25T02:02:51+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/display-only-tickets-on-sale\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/display-only-tickets-on-sale\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/display-only-tickets-on-sale\/#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":"Display only tickets on sale"}]},{"@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\/1560391","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\/1560391\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1560391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}