tribe_tickets_buy_button

Home Forums Ticket Products Event Tickets Plus tribe_tickets_buy_button

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1334042
    Luke Vaillancourt
    Participant

    I don’t want to show the total number of tickets until we are down to 10… but, I don’t want the “buy now” hidden from the list page (or event page). The code that I’ve found:

    function cliff_etplus_woo_conditional_hide_qty_remaining() {
    	wp_enqueue_script( 'jquery' );
    	?>
    	<script type="text/javascript">
    		jQuery(document).ready( function () {
    			var qty_remaining = jQuery( 'body.single-tribe_events .woocommerce .tribe-tickets-remaining > span.available-stock' ).first().text(); // would need to loop instead of use .first() to work for more than 1 WooCommerce ticket per Event
    			qty_remaining = parseInt( qty_remaining, 10 );
    			if ( ! isNaN( qty_remaining ) && 3 < qty_remaining ) {
    				jQuery( 'body.single-tribe_events .woocommerce .tribe-tickets-remaining' ).hide();
    			}
    		});
    	</script>
    	<?php
    }
    add_action( 'wp_head', 'cliff_etplus_woo_conditional_hide_qty_remaining' );
    
    add_filter( 'tribe_tickets_buy_button', '__return_empty_string' );

    Is good, except for if there are more than 3 tickets, it HIDES the quantity AND “buy button”.. is there a way to make it read “tickets available” if there are more than 10 tickets… and, if there are 10 or less have it show the actual quantity?

    #1334599
    Shelby
    Participant

    Hi Luke,

    I’m happy to help you out with this!

    Can you tell me where you found this code, and send me over a link to your site so I can take a look at some options for this for your situation?

    Please let me know, and we’ll work from there!

    Best,

    Shelby 🙂

    #1334862
    Luke Vaillancourt
    Participant

    Hey Shelby,

    I found the code simply Googling solutions.

    The site is here: https://worcesterwinefestival.com/events/

    As you can see, the “ticket count” (which is usually to the right of the price) is hidden… I miss the “buy now” function but don’t like being able to see the ticket count (at least until they are at risk of selling out). Thoughts?

    #1335262
    Shelby
    Participant

    Hey Luke,

    I plan to take a deeper dive on this one tomorrow. Thanks for hanging in there! 🙂

    Best,

    Shelby 🙂

    #1336234
    Luke Vaillancourt
    Participant

    Hey Shelby,

    any thoughts?

    #1337036
    Shelby
    Participant

    Hey Luke,

    My apologies. Apparently my last reply didn’t post. 🙁

    As always, back up your files before you change anything, but you’ll want to remove the following line from the bit of code that you shared with me:

     add_filter( 'tribe_tickets_buy_button', '__return_empty_string' );

    Let me know how that goes, and if you need any further help with this!

    Best,

    Shelby 🙂

    #1337042
    Luke Vaillancourt
    Participant

    Hi Shelby,

    Not a problem—figured something was up!

    I removed that line, but in doing so, it simply shows all of the tickets—not only if there is less than X. Again, I only want to show the quantity if it’s less than 10, for example. If there are 10 or more, I’d like it to read “Tickets Available”.

    Make sense?

    #1338266
    Shelby
    Participant

    Hey Luke,

    I understand what you’re trying to do, and I was afraid this might happen!

    In this case, it looks like we’d have to re-write the whole (or a large portion of the) function to serve this purpose, which is beyond the scope of the support we provide here. We use this forum to support issues with our plugins out of the box, as configured with the latest version of WordPress, WordPress default themes, and the rest of our plugin suite.

    I was hoping that I could help you out with some simple tweaks to this function that you posted, but unfortunately, that doesn’t seem to be the case. You may be able to hire a freelancer to help out with customizing this function to suit your needs. We have some freelancers and resources you can use here.

    Best of luck with your project! I’ll leave this open in case any other users who might be working on this kind of a customization as well, are able to provide you with any tips. Thanks for understanding & let us know should you have any questions in the future!

    Best,

    Shelby ?

    #1338284
    Luke Vaillancourt
    Participant

    Ah, that’s a real bummer considering it’s a feature that should exist and has a ton of Google search results. Maybe that can be prioritized? It seems like it would be simple code option…

    #1338488
    Shelby
    Participant

    Hi again Luke,

    So sorry to disappoint! We have several new features in the works and bugs to fix, so though it may seem simple, we do have to prioritize our efforts dev-wise. I’m sure you understand. 🙂

    One thing you can do, is suggest this feature on our feature request system here. Or, if you do end up figuring this one out and share your solution with us, we can try to put it on the dev schedule for extensions possibly.

    Thanks for understanding!

    Best,

    Shelby 🙂

    #1348648
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘tribe_tickets_buy_button’ is closed to new replies.