Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Returns the amount of active WooCommerce tickets for this event
- // Mostly useful for detecting if an event has tickets. Returns 0 for those.
- function tribe_get_wooticket_amount( $event_id = null ) {
- if ( is_object( $event_id ) )
- $event_id = $event_id->ID;
- if ( $event_id === null )
- $event_id = get_the_ID();
- $query = new WP_Query( array( 'post_type' => 'product',
- 'meta_key' => '_tribe_wooticket_for_event',
- 'meta_value' => $event_id,
- 'meta_compare' => '=',
- 'posts_per_page' => - 1,
- 'fields' => 'ids',
- 'post_status' => 'publish', ) );
- return count($query->posts);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement