Tribe__Tickets_Plus__Commerce__EDD__Main::hide_tickets_from_shop( string $query )
Generally speaking we want to hide the ticket products from the “storefront” and only expose them via the ticket form on single event pages.
Contents
Parameters
- $query
-
(string) (Required)
Source
File: src/Tribe/Commerce/EDD/Main.php
public function hide_tickets_from_shop( $query ) {
// Exceptions: don't interfere in the admin environment, for EDD API requests, etc
if ( is_admin() ) return;
if ( defined( 'EDD_DOING_API' ) && EDD_DOING_API ) return;
if ( empty( $query->query_vars['post_type'] ) || $query->query_vars['post_type'] != $this->ticket_object ) return;
if ( ! empty( $query->query_vars['meta_key'] ) && $query->query_vars['meta_key'] == $this->event_key ) return;
// Otherwise, build a list of post IDs representing tickets to ignore
if ( ! $query->is_singular ) {
$query->set( 'post__not_in', $this->get_all_tickets_ids() );
}
}