Unlimited tickets not recognized by function tribe_events_partially_soldout()
-
Hi,
on my website I wanted a call to action to refer to the next available ticket (future event) when a ticket is soldout. To build that I looked in the code to learn how to determine the stock level correctly.
When trying to differentiate tickets with unlimited stock and limited stock, I found (during testing) that the function tribe_events_partially_soldout() doesn’t recognize unlimited stock correctly. The function looks for (stock === “”) as an indication of unlimited stock, while the stock level of an unlimited ticket seems to be set to -1.
When I compare to the ticket template file “event-tickets\src\views\blocks\tickets\extra-available.php” and found there it unlimited stock is found by finding the value -1. So that confirms that the -1 value I found as a stock level is deliberate.
So it seems to me that the code in the function tribe_events_partially_soldout() should also compare to -1 to set the $unlimited_stock indication;
The line:
$unlimited_stock = $ticket_stock === '';
Should then change to something like:
$unlimited_stock = ( -1 === $ticket_stock );
As it is tribe_events_partially_soldout() doesn’t not correctly selects unlimited stock tickets so the result is probably incorrect too.
Regards
Hans
The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.