Display Price and Sold out

This topic contains 3 replies, has 2 voices, and was last updated by  Stephen Harris 2 months, 1 week ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #26982

    Hey i need just 2 more Shortcodes for Display.
    How can i display Sold out and the price in the event list?

    Christoph Steinlechner
    #26984

    Hi Christoph,

    Can you provide a bit more detail on what you’re trying to achieve? Can you give an example of how you plan to use these shortcode, and where?

    The booking form already displays ‘sold out’ if the ticket has sold out. If selling by date it will disable sold-out dates. Lastly, it will display a sold out message if all tickets are sold out.

    Stephen Harris
    #26986

    After startdate i want eg: %event_price%

    [eo_events numberposts=10 group_events_by=series showpastevents=false]
    %event_title%
    %event_venue%
    %start{d.m.}% – %end{d.m.o}%
    [/eo_events]

    and in the same if the seminar is sold out display text like sold out.

    Christoph Steinlechner
    #27103

    Ok, those placeholders aren’t available. When you require a bit more advanced logic (extracting a ticket price, or displaying a message subject to a condition), the best way forward is to use the shortcode template not the placeholders.

    If you use the shortcode as self-closing. i.e. not [/eo_events] then it will default to the template in templates/shortcode-event-list.php. You can then implement the desired output using PHP.

    If you need any help on doing that, just let me know. But you can get the tickets of an event with eo_get_event_tickets( get_the_ID() ) and you can get remaining tickets with:

    $occurrence_tickets = eo_get_the_occurrences_tickets( get_the_ID() );
    $sold_out = ! $occurrence_tickets || ! eventorganiser_list_sum( $occurrence_tickets, 'available' );
    
    if ( $sold_out ) {
         echo 'Event sold out';
    }
    
    Stephen Harris
Viewing 4 posts - 1 through 4 (of 4 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.