Order::get_fees( array $args = array() )

Get the fees for the order.


Parameters #

$args

(array) (Optional) List of arguments to override fees handling. @var string $fee_type Fee type (optional). @var Gateway_Abstract $gateway Gateway object (optional). @var string $limit_by_operation Which operation to limit by (optional). @var int $limit_by_event_id Which event ID to limit by (optional).

Default value: array()


Top ↑

Return #

(float) Fees for the order.


Top ↑

Source #

File: src/Tribe/Payouts/Order.php

	public function get_fees( array $args = [] ) {
		$gateway            = ! empty( $args['gateway'] ) ? $args['gateway'] : null;
		$limit_by_operation = ! empty( $args['limit_by_operation'] ) ? $args['limit_by_operation'] : null;
		$limit_by_event_id  = ! empty( $args['limit_by_event_id'] ) ? $args['limit_by_event_id'] : null;

		$all_data = empty( $limit_by_operation ) && empty( $limit_by_event_id );

		if ( $all_data && ! empty( $this->fees ) ) {
			return $this->fees;
		}

		// Get gateway if not set.
		if ( null === $gateway ) {
			/** @var Main $main */
			$main = tribe( 'community-tickets.main' );

			/** @var Gateway_PayPal $gateway */
			$gateway = $main->gateway( 'PayPal' );
		}

		$receivers = $this->get_receivers();

		$fees = 0;

		foreach ( $receivers as $receiver ) {
			$fees += $receiver->get_fees( $args );
		}

		if ( $all_data ) {
			$this->fees = $fees;
		}

		return $fees;
	}

Top ↑

Changelog #

Changelog
Version Description
4.7.1 Introduced.