Output onsale date

Home Forums Ticket Products Event Tickets Plus Output onsale date

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1552406
    Luke Kenny
    Participant

    When WooCommerce tickets have been created for a published event, however have an on sale date in the future, how can I display a message that “tickets go on sale xx-xx-2018”?

    I have tried an override in /tribe-events/wootickets/tickets.php, where there is an if statement on line 75 checking the tickets date is in range (I added an else with an echo to the bottom of that.) However this only appears to be executed when at least one ticket for the event is onsale now.

    Ie. if I have two tickets, one onsale now and one onsale in the future, I’ll get the purchase option for the onsale ticket and the message for the other.

    But if both tickets (or if there is only one ticket) attached to the event, nothing comes up at all.

    #1553636
    Sky
    Keymaster

    Hi there!

    Thanks for reaching out. I will try to help with your question. Please note that we are limited in the amount of support we can provide for customizations such as this here in our support forums. This may a bit beyond the scope of what I can help with, but I will try my best to get you pointed in the right direction.

    Looking at the templates, it seems that the tickets.php file doesn’t get loaded if there are no tickets within the “on sale” range. This logic takes place in the event-tickets-plus/src/Tribe/Commerce/WooCommerce/Main.php file. Unfortunately, this is not a file that you can override by putting a copy in your child theme.

    There is however, an action hook in there that fires when it determines that there isn’t a ticket that fits within the timeframe. Here is a copy of the hook, with it’s notes on use:

    /**
    * Allow to hook into the FE form of the tickets if tickets has already expired. If the action used the
    * second value for tickets make sure to use a callback instead of an inline call to the method such as:
    *
    * Example:
    *
    * add_action( ‘tribe_tickets_expired_front_end_ticket_form’, function( $must_login, $tickets ) {
    * Tribe__Tickets_Plus__Attendees_List::instance()->render();
    * }, 10, 2 );
    *
    * If the tickets are not required to be used on the view you an use instead.
    *
    * add_action( ‘tribe_tickets_expired_front_end_ticket_form’, array( Tribe__Tickets_Plus__Attendees_List::instance(), ‘render’ ) );
    *
    * @since TBD
    *
    * @param boolean $must_login
    * @param array $tickets
    */
    do_action( ‘tribe_tickets_expired_front_end_ticket_form’, $must_login, $tickets );

    You may be able to use the same logic from within tickets.php to output what you want here, by looping through the $tickets array.

    Hope that helps! Let me know if you have more questions about this.

    Thanks,
    Sky

    #1569302
    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 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Output onsale date’ is closed to new replies.