Add tickets_nostock or out of stock class to event calendar and list pages

Home Forums Ticket Products Event Tickets Plus Add tickets_nostock or out of stock class to event calendar and list pages

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #953258
    Andrew
    Participant

    I’m working with a client for his WooCommerce Tickets setup and we’re trying to display an indication on the events calendar page and the events listing page that any events that are sold out/no stock remaining get an indicator of some kind.

    I’m not an expert on these plugins, so I wanted to ask if someone could point me in the right direction on setting this up? Or do I need to check in with the WooCommerce folks?

    #953363
    George
    Participant

    Hey Andrew,

    Something like this is indeed possible, though it unfortunately requires some code customization. While that’s a bit beyond the scope of our support forums, here’s a quick example of adding “SOLD OUT!” before the text of an event title if it is, indeed sold out:

    
    add_filter( 'the_title', 'maybe_add_sold_out_to_events_title' );
    
    function maybe_add_sold_out_to_events_title( $title ) {
    	$post_id = get_the_ID();
    
    	if ( ! tribe_is_event( $post_id ) ) {
    		return $title;
    	}
    
    	if ( tribe_events_has_soldout( $post_id ) ) {
    		return 'SOLD OUT! ' . $title;
    	}
    
    	return $title;
    }
    

    If you’re looking for another way to indicate an event is sold out, then our knowledgebase article on this topic should be quite helpful → https://theeventscalendar.com/knowledgebase/adding-sold-out-notices-in-list-view/

    Hopefully this information gets you started. One extra tidbit is this Gist of some useful “conditional” functions, which would help you limit the display of your “Sold Out!” notice to only specific events views → https://gist.github.com/jo-snips/2415009

    Cheers!
    George

    #953478
    Andrew
    Participant

    Many thanks for the tips and ideas. Really appreciate the support.

    #953568
    George
    Participant

    No problem Andrew! Hope it helps.

    Best of luck with your project, cheers!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Add tickets_nostock or out of stock class to event calendar and list pages’ is closed to new replies.