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 behavior 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) Whether user is able to delete existing tickets before applying this function's logic.

$ticket_id

(int) (Required) The Ticket's Post ID.


Top ↑

Return

(bool) Whether user is able to delete existing tickets after applying this function's logic.


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;
	}