Tribe__Events__Community__Tickets__Main::can_delete_existing_ticket( bool $can_delete, int $ticket_id )

Filters the user’s ability to delete existing tickets.

The default behaviour is to disallow deletion of tickets once sales have been made. This can be overridden via the following filter hook, which this callback itself runs on:

tribe_tickets_current_user_can_delete_ticket

Parameters #

$can_delete

(bool) (Required)

$ticket_id

(int) (Required)


Top ↑

Return #

(bool)


Top ↑

Source #

File: src/Tribe/Main.php

	public function can_delete_existing_ticket( $can_delete, $ticket_id ) {
		$event = tribe_events_get_ticket_event( $ticket_id );
		if ( tribe_community_events_is_community_event( $event ) ) {
			$total_sales = get_post_meta( $ticket_id, 'total_sales', true );

			if ( $total_sales ) {
				return false;
			}
		}

		return $can_delete;
	}