Help Desk

Hide ticket fields after sale window is over

  • Posts: 12 Topics: 3
    | Permalink

    Hi –

    Is there a way to hide the ticket-related fields for an event when the sales window has passed? For example, I’d like to remove the price and the large “Tickets” header when nothing is on sale. See screenshot.

    Thanks!

    TJ

    Posts: 2
    | Permalink

    Same here. We want to stop selling tickets one hour before the start of the event (12:00pm) and we have set the “End Sale” in the ticket settings for 11:00am. If the event is not sold out, tickets are still available until the end-time of the event (4:00pm), not the end sale time. Any way to have the tickets not show on the single event page after a specified time? (11:00am in our case). Thanks so much.

    Posts: 2616
    | Permalink

    Hi TJ,

    There should be a message that displays to notify users that tickets are not currently available. We have an internal ticket open to address this issue, and I’ve linked this thread to it – as soon as we have an update, we’ll let you know here.

    In the meantime, you can customize the template for the ticket form to hide it when tickets are not available. You’ll need to follow the instructions in our themer’s guide to copy the template into your child theme for editing. The template can be found at wp-content/plugins/event-tickets-plus/src/views/wootickets/tickets.php. I went ahead and made an example for you here, which will simply hide the entire form if there are no tickets currently on sale.

    Please let me know if this helps and if you have any questions!

    Thanks,

    Jennifer

    Posts: 2616
    | Permalink

    Hi @skunkperecords,

    The tickets shouldn’t be available after the end sale time.

    Since this isn’t working for you, can you please open up a new thread and share your system info with us so that we can help you get this figured out? If you haven’t done so already, you’ll also want to test for conflicts with your theme and other plugins.

    Thanks,

    Jennifer

    Posts: 12 Topics: 3
    | Permalink

    Hi Jennifer. Thanks for the sample! Works great for now.

    Can you also tell me how to hide / tweak the price text that is getting added next to the date (see original screenshot “February 3rd @ 7:30 am – $20”)?

    Posts: 12 Topics: 3
    | Permalink

    Hi Jennifer –

    I lied; the above change did not work. I simply wrapped the form in

    This ended up always hiding the ticket form; was never evaluating to true.

    Did I do something wrong?

    TJ

    Posts: 2616
    | Permalink

    Hi TJ,

    I’m sorry that it’s not working…Did you copy the template I sent you into your copy of the tickets.php template in your child theme? I just tested it out again on my end…the form is completely hidden after the ticket sale period, but it does display when tickets are on sale.

    Did you wrap the form in an “if” statement using the tribe_events_has_tickets_on_sale() function? It looks like you may have copied the code you used into your reply, but if so, it did not come through.

    If the example I sent isn’t working for you, I would recommend testing for conflicts with your theme and other plugins to see if there is something else that might be interfering.

    Regarding the price next to the date and time, you can find the code for that in the single-event.php template (found at wp-content/plugins/the-events-calendar/src/views:

    
    <div class="tribe-events-schedule tribe-clearfix">
        <?php if ( ! tribe_is_event_category( 'testing' ) : echo tribe_events_event_schedule_details( $event_id, '<h2>', '</h2>' ); endif; ?>
        <?php if ( tribe_get_cost() ) : ?>
            <span class="tribe-events-cost"><?php echo tribe_get_cost( null, true ) ?></span>
        <?php endif; ?>
    </div>
    
    

    You can edit this template the same way as the tickets.php template, by following the instructions in our themer’s guide.

    Let me know if you’re able to get it working!

    Posts: 12 Topics: 3
    | Permalink

    Hi Jennifer –

    The fix for hiding the tickets form when tickets are not on sale, does actually now work. I tested it incorrectly last time I wrote in.

    Just curious though – how come you don’t have to pass in the $event_id to the tribe_events_has_tickets_on_sale() function?

    Regarding, hiding the price
    – I’ve copied wp-content/the-events-calendar/src/views/single-event.php -> themes/[my-theme]/tribe-events/single-event.php
    – I added a check in here to see if tickets were on sale to line 44:

    The price still shows up. What am I doing wrong?

    Thanks!

    TJ

    • This reply was modified 1 week, 1 day ago by  TJ.
    • This reply was modified 1 week, 1 day ago by  TJ.
    • This reply was modified 1 week, 1 day ago by  TJ.
    • This reply was modified 6 days, 3 hours ago by  Leah.
    Posts: 12 Topics: 3
    | Permalink

    Hi Jennifer –

    The fix for hiding the tickets form when tickets are not on sale, does actually now work. I tested it incorrectly last time I wrote in.

    Just curious though – how come you don’t have to pass in the $event_id to the tribe_events_has_tickets_on_sale() function?

    Regarding, hiding the price
    – I’ve copied wp-content/the-events-calendar/src/views/single-event.php -> themes/[my-theme]/tribe-events/single-event.php
    – I added a check in here to see if tickets were on sale to line 44:

    The price still shows up. What am I doing wrong?

    Thanks!

    TJ

    Posts: 2616
    | Permalink

    Hi TJ,

    So sorry for the delayed response here, we’ve had a very high volume of threads in the forums here lately. I apologize about that!

    I’m glad that code is working for you…You are right, the tribe_events_has_tickets_on_sale function actually should be passed the event ID.

    For the price, I copied and pasted your template into my local environment, and it is working for me…when tickets are on sale, the price shows up (see screenshot), but it is hidden when the current date is outside the on-sale date range (see screenshot).

    Two things I noticed:

    • You’re using the Enfold theme, which has it’s own templates that override our template files. I believe you may need to take one extra step to get your template displayed instead of the Enfold version. I did a quick search to see if I could find any instructions for you, and I came across this thread, which looks like it has what you need (I was not able to see everything as you need to login to see the rest, but you should be able to access it if you have an active license). Also, as the user points out in that thread, you may want to make this modification in the Enfold version of the single-event.php template instead of our default version.
    • You are using an older version of The Events Calendar (4.6.8). Can you try updating to the current version (4.6.11.1) to see if that makes a difference? If you don’t see a prompt to update in the Plugins section of your Dashboard, you can do so manually by following these instructions.

    Please let me know if this helps!

    Thanks,

    Jennifer

You must be logged in and hold an active support license to create new topics in the help desk. Please visit our products store to purchase a license.

Subscribe to Updates