Events Manager
[resolved] Hide price when it is zero (8 posts)

  1. AJD
    Posted 1 year ago #

    I am inserting a booking price into the events sidebar widget.

    If I use it like this:


    The result displays 0.00 even on events with booking disabled.

    How to show the booking price in the sidebar widget only if bookings are enabled for that event?



  2. angelo
    NetWebLogic Support
    Posted 1 year ago #

    I tried this one and seems to be working fine however could it be that the events is fully booked and/or you have free tickets?

  3. AJD
    Posted 1 year ago #

    Hi, yes, some of the events had the free default ticket still showing. Some of them were past the booking deadline. It seems to show $0 if the event is fully booked or past its booking deadline.

    Is there a way to change this? It would better to have a message like in the events page where it says: "Bookings are closed for this event."


  4. angelo
    NetWebLogic Support
    Posted 1 year ago #

    yes, you can override that or create your own using this tutorial - http://wp-events-plugin.com/tutorials/create-a-custom-placeholder-for-event-formatting/

    *you can see the original snippet at events-manager/classes/em-event.php at around lines 1549-1574

  5. AJD
    Posted 1 year ago #

    Just to clarify. When a booking has past its deadline or is fully booked the intended output of '#_EVENTPRICERANGE' is '$0.00'?

    If so, my question is: "How to show the price range of an event and when the bookings are full show: "Bookings Full" or if passed the deadline show: "Booking Deadline Passed" ?

    It sounds like the only solution is to make a custom placeholder, however I do not see how lines 1549-1574 of em-event.php relates to that. I don't see any reference there for the output of #_EVENTPRICERANGE.


  6. Philip John
    Posted 1 year ago #


    It is likely that you will need your own custom placeholder for this, yes.

    I'm afraid I'm not sure what Angelo was pointing to in em-event.php so perhaps he can provide an answer there.


  7. AJD
    Posted 1 year ago #

    Okay, thanks.

    The behavior of defaulting to $0.00 for events that are passed, or full or even events that don't have booking enabled seems a bit clunky.

    However, I am close to finding a solution using nested conditional tags like this:

    {has_bookings} <!-- Check that an event has bookings, so we don't show '$0.00 - $0.00' on all events. -->
    {fully_booked}Fully Booked.{/fully_booked}<!-- In case all tickets are sold. -->
    {is_future} <!-- Then check to make sure that the event is future, so we don't show '$0.00 - $0.00' as the price for an event that has passed. -->
    <span class="em_cost">#_EVENTPRICEMIN - #_EVENTPRICEMAX</span> <!-- show the price range on all future events with booking enabled. -->
    {is_past}Event is over.{/is_past}<!-- If the event is over. -->

    I also needed to add:


    in wp-config.php


  8. caimin_nwl
    NetWebLogic Support
    Posted 1 year ago #

    Cool. Thanks for posting an update, it'll probably help someone else out.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Events Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic