Posted: June 4, 2020 at 5:18 am
Is there a way with the ESPRESSO_EVENTS shortcode to filter out sold out events? I can’t see anything here – |
|
Hi Dee, We don’t currently have a shortcode parameter for this. We do have a snippet of code that can do this here: https://eventespresso.com/topic/ee4-hide-sold-out-events-from-espresso_events-category_slug-page/ That would remove the events from all listings on the site, will that work for you? |
|
I’ve had that snippet in a plugin for a few years now (with this modification – https://eventespresso.com/topic/ee4-hide-sold-out-events-from-espresso_events-category_slug-page/#post-160482 ) . It’s working perfectly for the calendar, and the upcoming events widget…. but not for the ESPRESSO_EVENTS shortcode? |
|
That snippet should apply to the ESPRESSO_EVENTS shortcode. How are you adding that shortcode to the page? Using a page builder? Can you post the full snippet you are using so I can test it locally? |
|
The shortcode is added using the standard WordPress page editor. No page builders or anything like that. It’s in a Paragraph block by itself. The HTML view shows: The Snippet is:
|
|
The shortcode displays at the bottom of the front page You’ll see there’s a “Sold Out” event which shouldn’t be visible (and doesn’t appear in the widget or the calendar in the sidebar), and the upcoming Wednesday event which should be displaying. |
|
Was there only a single ticket on that event? Also, does the ‘sold’ value match the limit set on the ticket? The snippet doesn’t specifically check for an Event Post status, it’s checking the TKT_sold value is less than the TKT_qty value (meaning it’s pulling events where the ticket it’s using aren’t sold out) on a ticket within the event. |
|
Note that the snippet works locally for me: https://monosnap.com/file/mVYmHtAUEcow441yQJvwsUEQ2K9iS9 Thats just a page with |
|
On that event there were four tickets, only one sold. So the “Sold Out” status was set manually. So, if I understand correctly, the shortcode is just looking to include for events where tickets are still available… I was thinking it was displaying all events, and then snippet was excluding sold-out and expired events. This is incorrect. Is it possible to change the snippet to not display “Sold Out” status events (regardless of ticket sales)? Thanks for the support. |
|
It makes the query a little bit odd, but try something like this: https://gist.github.com/Pebblo/285340c950796e16eae8ba1d2e520513 You would use that function in place of the 2 used previously. |
|
The support post ‘Shortcode – ESPRESSO_EVENTS’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.