Show price range or cheapest ticket next to title with tribe_get_cost

Home Forums Ticket Products Event Tickets Plus Show price range or cheapest ticket next to title with tribe_get_cost

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #971242
    inspyrmedia
    Participant

    By default tribe_get_cost grabs the pricing for last ticket created with WooTickets and displays it next to the event title in the list view and single event view.

    While this is fine for single ticket events, it makes little sense for events with multiple tickets, as you’ll want to either display the price range or display the price of the cheapest ticket available. This makes a lot of sense in retail psychology, as people are more inclined to buy something that seems cheap (even if they buy a more expensive version).

    I recently applied this snippet from the knowledge base to properly sort my tickets:

    function tribe_wootickets_custom_sort($p, $q) {
            if ($p->price < $q->price) return -1;
            if ($p->price > $q->price) return 1;
            return 0;
    }

    I also know how to modify the population of the field that contains tribe_get_cost, but I do not know how to modify the actual tribe_get_cost call in such a way that it will display a price range or the cheapest ticket like you can do with the wootickets_custom_sort function.

    It would be great if Modern Tribe could provide me with a snippet for both scenarios!

    Thanks in advance!

    #971421
    Geoff
    Member

    Hello inspyrmedia!

    Thatโ€™s a great question. I was able to dig up this thread that covers exactly that–showing a price range if multiple tickets exist. It will take a couple of template overrides as well, but this should give you those steps and get you started.

    Will that work for you? Please let me know. ๐Ÿ™‚

    Cheers!
    Geoff

    #971544
    inspyrmedia
    Participant

    Geoff: Thank you for that link. With some minor changes to the code, due to code base changes in the latest release, I was able to properly integrate this into The event calendar and all associated views.

    If at all possible, I wouldn’t mind seeing this integrated into a next release of TEC / WooTickets. Preferably in a dropdown menu that allows you to select a global default with the options: lowest / highest / range / first / last. And optionally the feature to override the global default on a per-event level by selecting the preferred display-price through a dropdown.

    #971890
    Geoff
    Member

    Sweet, nice work! I’m so glad that helped get the ball rolling. Good catch on the new release changes, too–I definitely should have given you a heads up on that.

    That’s a nice feature suggestion as well. In fact, if you have a moment, I’d love for you to throw that up on our UserVoice forum. We track feature requests there and I can see how other might find that super handy as well–it’s be nice to see what sort of feedback and dialogue build around that.

    I’ll go ahead and close this thread. Thanks again for reaching out and see you over in UserVoice. ๐Ÿ™‚

    Cheers!
    Geoff

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Show price range or cheapest ticket next to title with tribe_get_cost’ is closed to new replies.