Tribe__Tickets_Plus__Meta::get_cart_data( array $data, array $providers, int $post_id )

Get cart data for Attendee Registration.


Parameters #

$data

(array) (Required) Cart response data.

$providers

(array) (Required) List of cart providers.

$post_id

(int) (Required) Post ID for cart.


Top ↑

Return #

(array) Cart data for Attendee Registration.


Top ↑

Source #

File: src/Tribe/Meta.php

	public function get_cart_data( $data, $providers, $post_id ) {
		$data['is_stored_meta_up_to_date'] = 1;
		$data['attendee_registration_url'] = '';

		if ( empty( $data['tickets'] ) ) {
			return $data;
		}

		/** @var Tribe__Tickets_Plus__Meta__Contents $contents */
		$contents = tribe( 'tickets-plus.meta.contents' );
		$tickets  = $data['tickets'];

		// Get ticket IDs.
		$tickets_for_meta = wp_list_pluck( $tickets, 'quantity', 'ticket_id' );

		$data['is_stored_meta_up_to_date'] = (int) $contents->is_stored_meta_up_to_date( $tickets_for_meta );

		/** @var Tribe__Tickets__Attendee_Registration__Main $attendee_reg */
		$attendee_reg = tribe( 'tickets.attendee_registration' );

		$first_provider = current( $providers );

		$data['attendee_registration_url'] = add_query_arg( 'provider', $first_provider, $attendee_reg->get_url() );

		if ( ! empty( $post_id ) ) {
			$data['attendee_registration_url'] = add_query_arg( 'tribe_tickets_post_id', (int) $post_id, $data['attendee_registration_url'] );
		}

		return $data;
	}

Top ↑

Changelog #

Changelog
Version Description
4.11.0 Introduced.