Tribe__Events__Community__Tickets__Main::order_report_site_fees_note( WP_Post $unused_event, WP_User $unused_organizer )

Injects a meta note about site fees in the Order Report


Parameters #

$unused_event

(WP_Post) (Required) Event post

$unused_organizer

(WP_User) (Required) Community Organizer user object


Top ↑

Source #

File: src/Tribe/Main.php

	public function order_report_site_fees_note( $unused_event, $unused_organizer ) {
		$options = get_option( self::OPTIONNAME, self::instance()->option_defaults );
		$gateway = self::instance()->gateway( 'PayPal' );

		$flat = $gateway->fee_flat;
		$percentage = $gateway->fee_percentage;

		if ( tribe( 'community.tickets.fees' )->is_flat_fee( $options['site_fee_type'] ) ) {
			$flat += (float) $options['site_fee_flat'];
		}

		if ( tribe( 'community.tickets.fees' )->is_percentage_fee( $options['site_fee_type'] ) ) {
			$percentage += (float) $options['site_fee_percentage'];
		}

		$flat_message = sprintf(
			__( 'Site Fee: %s per order', 'tribe-events-community-tickets' ),
			esc_html( tribe_format_currency( number_format( $flat, 2 ) ) )
		);

		$percentage_message = sprintf(
			__( 'Site Fee Percentage: %s%%', 'tribe-events-community-tickets' ),
			esc_html( $percentage )
		);

		// TODO: move this to the fee class
		if ( 'flat' === $options['site_fee_type'] ) {
			return $flat_message;
		} elseif ( 'percentage' === $options['site_fee_type'] ) {
			return $percentage_message;
		} elseif ( 'flat-and-percentage' === $options['site_fee_type'] ) {
			return "{$flat_message}, {$percentage_message}";
		}
	}