Hooks::filter_cart_providers( array $data, array $providers, int|null $post_id )

For some reason we ended up with other providers showing up on Tickets Commerce cart, so we remove them in case we are dealing with Tickets Commerce cart.


Parameters #

$data

(array) (Required)

$providers

(array) (Required)

$post_id

(int|null) (Required)


Top ↑

Return #

(array)


Top ↑

Source #

File: src/Tickets_Plus/Commerce/Attendee_Registration/Hooks.php

	public function filter_cart_providers( $data, $providers, $post_id ) {
		$cookie = tribe_get_request_var( Cart::$cookie_query_arg );

		// If we dont have a cookie hash passed we just bail, since it means it's not Tickets Commerce.
		if ( empty( $cookie ) ) {
			return $data;
		}

		// Reset keys.
		$data['tickets'] = array_filter( $data['tickets'], static function ( $ticket ) {
			return ( Commerce::PROVIDER === $ticket['provider'] );
		} );

		return $data;
	}

Top ↑

Changelog #

Changelog
Version Description
5.3.0 Introduced.