End Sale to Display Out of Stock Instead of disappearing

Home Forums Ticket Products Event Tickets Plus End Sale to Display Out of Stock Instead of disappearing

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #940182
    Studio Sands
    Participant

    Hi,
    Currently, when you set the event to end sale on a particular date and time,
    the entire “add to cart” portion disappears.
    Can it display “Out of Stock” instead of disappearing altogether?
    Thanks!
    Arnold

    #940240
    Barry
    Member

    Hi there Arnold,

    That’s definitely possible if you don’t mind doing a little customization work 🙂

    In the first instance, please familiarize yourself with the Themer’s Guide (if you haven’t already done so) which covers most of the basics for this sort of work. In this particular case you would probably wish to modify the wootickets/tickets.php template and modify the logic in there.

    Does that help?

    #940849
    Studio Sands
    Participant

    Possible to give some clue on the php code??

    #940910
    Barry
    Member

    Hi!

    For customization work like this it’s largely something you need to drive forward under your own steam.

    We’re always happy to try and point you in the right direction of course, but please do bear in mind we cannot offer further support for any changes you make or any problems that might result – so it is fairly important you have enough of an understanding to maintain your work by yourself in the future 🙂

    In this case, if you open up your custom version of wootickets/tickets.php you should see a line of code like this (approx line 39 in the default template that ships with our current release):

    if ( ( empty( $start_date ) || time() > $start_date ) && ( empty( $end_date ) || time() < $end_date ) ) {

    This is what ignores events that are not yet on sale/have passed the end sale date. It’s actually the first line of an if block, which runs for many lines (ends on line 73):

    if ( ( empty( $start_date ) || time() > $start_date ) && ( empty( $end_date ) || time() < $end_date ) ) {
        //         ...
        // ...lots of lines...
        //         ...
    }

    We want to keep the code in the middle (lines 40-72) but dispose of the first line and the final line (which contains just a curly brace) – the tickets should then always be visible.

    In your case you want to show a Sold Out message if they aren’t currently on sale/sale of the tickets has ended, so you’re going to need to amend this line:

    if ( $product->is_in_stock() ) {

    Add the necessary checks in here to also test if the product is currently on sale – and those checks would basically be the same as the ones containined in the opening if statement that we just removed 🙂

    I hope that gives you a few more ideas and good luck with the customization – as we can’t really do much more to help with this one I’m going to go ahead and close out the topic, but please do feel free to open new ones as required if any other issues crop up.

    Thanks!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘End Sale to Display Out of Stock Instead of disappearing’ is closed to new replies.