Tribe__Tickets_Plus__Meta__Storage::clear_meta_data_for( int $id )

Clears the stored data associated with a ticket.


Parameters

$id

(int) (Required) A ticket ID


Top ↑

Return

(bool) Whether the data for the specified ID was stored and cleared; false otherwise.


Top ↑

Source

File: src/Tribe/Meta/Storage.php

	public function clear_meta_data_for( $id ) {
		if ( empty( $_COOKIE[ self::HASH_COOKIE_KEY ] ) ) {
			return false;
		}

		$transient = self::TRANSIENT_PREFIX . $_COOKIE[ self::HASH_COOKIE_KEY ];
		$data      = get_transient( $transient );

		if ( empty( $data ) ) {
			return false;
		}

		if ( ! isset( $data[ $id ] ) ) {
			return false;
		}

		unset( $data[ $id ] );

		if ( empty( $data ) ) {
			delete_transient( $transient );
			$this->delete_cookie();
			$this->delete_woocommerce_session( $id );
		} else {
			set_transient( $transient, $data, $this->ticket_meta_expire_time );
		}

		return true;
	}