Tribe__Tickets_Plus__Meta::update_ticket_meta( array $meta, array $tickets, string $provider, int $post_id, boolean $additive )

Update ticket meta from Attendee Registration.


Parameters #

$meta

(array) (Required) List of meta for each ticket to be saved for Attendee Registration.

$tickets

(array) (Required) List of tickets with their ID and quantity.

$provider

(string) (Required) The cart provider.

$post_id

(int) (Required) Post ID for the cart.

$additive

(boolean) (Required) Whether to add or replace meta.


Top ↑

Source #

File: src/Tribe/Meta.php

	public function update_ticket_meta( $meta, $tickets, $provider, $post_id, $additive ) {
		$ticket_meta = [];

		if ( $additive ) {
			$ticket_meta = $this->storage->get_meta_data();
		}

		foreach ( $meta as $ticket ) {
			$ticket_id = $ticket['ticket_id'];

			if ( ! isset( $ticket_meta[ $ticket_id ] ) ) {
				$ticket_meta[ $ticket_id ] = [];
			}

			foreach ( $ticket['items'] as $item ) {
				$ticket_meta[ $ticket_id ][] = $item;
			}
		}

		// Maybe set attendee meta cookie and handle saving of meta.
		$this->storage->maybe_set_attendee_meta_cookie( $ticket_meta, $provider );
	}

Top ↑

Changelog #

Changelog
Version Description
4.11.0 Introduced.