Order::register_statuses( array $statuses )

Filtering the list of all order statuses to add ET+ provider order statuses.

This can be moved in the future into each commerce provider class when we add order status filters to the Attendees repository.


Parameters

$statuses

(array) (Required) List of all order statuses.


Top ↑

Source

File: src/Tribe/Repositories/Order.php

	public function register_statuses( $statuses ) {
		/** @var Tribe__Tickets__Status__Manager $status_mgr */
		$status_mgr = tribe( 'tickets.status' );

		$has_wc  = class_exists( 'WooCommerce' );
		$has_edd = defined( 'EDD_VERSION' ) && class_exists( 'Easy_Digital_Downloads' );

		if ( $has_wc ) {
			$statuses = array_merge( $statuses, $status_mgr->get_statuses_by_action( 'all', 'woo' ) );
		}

		if ( $has_edd ) {
			$edd_statuses = $status_mgr->get_statuses_by_action( 'all', 'edd' );

			// Remove complete status.
			$edd_statuses = array_diff( [ 'Complete' ], $edd_statuses );

			$statuses = array_merge( $statuses, $edd_statuses );
		}

		// Enforce lowercase for comparison purposes.
		$statuses = array_map( 'strtolower', $statuses );

		// Prevent unnecessary duplicates.
		$statuses = array_unique( $statuses );

		return $statuses;
	}

Top ↑

Changelog

Changelog
Version Description
5.2.0 Introduced.