{"id":1334042,"date":"2017-08-11T07:55:20","date_gmt":"2017-08-11T14:55:20","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_tickets_buy_button\/"},"modified":"2017-08-11T07:55:20","modified_gmt":"2017-08-11T14:55:20","slug":"tribe_tickets_buy_button","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_tickets_buy_button\/","title":{"rendered":"tribe_tickets_buy_button"},"content":{"rendered":"<p>I don&#8217;t want to show the total number of tickets until we are down to 10&#8230; but, I don&#8217;t want the &#8220;buy now&#8221; hidden from the list page (or event page). The code that I&#8217;ve found:<\/p>\n<pre><code>function cliff_etplus_woo_conditional_hide_qty_remaining() {\n\twp_enqueue_script( &#039;jquery&#039; );\n\t?&gt;\n\t&lt;script type=&quot;text\/javascript&quot;&gt;\n\t\tjQuery(document).ready( function () {\n\t\t\tvar qty_remaining = jQuery( &#039;body.single-tribe_events .woocommerce .tribe-tickets-remaining &gt; span.available-stock&#039; ).first().text(); \/\/ would need to loop instead of use .first() to work for more than 1 WooCommerce ticket per Event\n\t\t\tqty_remaining = parseInt( qty_remaining, 10 );\n\t\t\tif ( ! isNaN( qty_remaining ) &amp;&amp; 3 &lt; qty_remaining ) {\n\t\t\t\tjQuery( &#039;body.single-tribe_events .woocommerce .tribe-tickets-remaining&#039; ).hide();\n\t\t\t}\n\t\t});\n\t&lt;\/script&gt;\n\t&lt;?php\n}\nadd_action( &#039;wp_head&#039;, &#039;cliff_etplus_woo_conditional_hide_qty_remaining&#039; );\n\nadd_filter( &#039;tribe_tickets_buy_button&#039;, &#039;__return_empty_string&#039; );<\/code><\/pre>\n<p>Is good, except for if there are more than 3 tickets, it HIDES the quantity AND &#8220;buy button&#8221;.. is there a way to make it read &#8220;tickets available&#8221; if there are more than 10 tickets&#8230; and, if there are 10 or less have it show the actual quantity?<\/p>\n","protected":false},"template":"","class_list":["post-1334042","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>tribe_tickets_buy_button -<\/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\/tribe_tickets_buy_button\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"tribe_tickets_buy_button -\" \/>\n<meta property=\"og:description\" content=\"I don&#8217;t want to show the total number of tickets until we are down to 10&#8230; but, I don&#8217;t want the &#8220;buy now&#8221; hidden from the list page (or event page). The code that I&#8217;ve found: function cliff_etplus_woo_conditional_hide_qty_remaining() { wp_enqueue_script( &#039;jquery&#039; ); ?&gt; &lt;script type=&quot;text\/javascript&quot;&gt; jQuery(document).ready( function () { var qty_remaining = jQuery( &#039;body.single-tribe_events .woocommerce [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_tickets_buy_button\/\" \/>\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\/tribe_tickets_buy_button\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_tickets_buy_button\/\",\"name\":\"tribe_tickets_buy_button -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2017-08-11T14:55:20+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_tickets_buy_button\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_tickets_buy_button\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_tickets_buy_button\/#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\":\"tribe_tickets_buy_button\"}]},{\"@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":"tribe_tickets_buy_button -","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\/tribe_tickets_buy_button\/","og_locale":"en_US","og_type":"article","og_title":"tribe_tickets_buy_button -","og_description":"I don&#8217;t want to show the total number of tickets until we are down to 10&#8230; but, I don&#8217;t want the &#8220;buy now&#8221; hidden from the list page (or event page). The code that I&#8217;ve found: function cliff_etplus_woo_conditional_hide_qty_remaining() { wp_enqueue_script( &#039;jquery&#039; ); ?&gt; &lt;script type=&quot;text\/javascript&quot;&gt; jQuery(document).ready( function () { var qty_remaining = jQuery( &#039;body.single-tribe_events .woocommerce [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_tickets_buy_button\/","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\/tribe_tickets_buy_button\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_tickets_buy_button\/","name":"tribe_tickets_buy_button -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2017-08-11T14:55:20+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_tickets_buy_button\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_tickets_buy_button\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/tribe_tickets_buy_button\/#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":"tribe_tickets_buy_button"}]},{"@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\/1334042","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\/1334042\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1334042"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}