Tribe__Tickets_Plus__Commerce__WooCommerce__Main::attendee_decreases_inventory( array $attendee )

Check if given attendee should reduce stock or not.


Parameters

$attendee

(array) (Required) Attendee data.


Top ↑

Return

(bool)


Top ↑

Source

File: src/Tribe/Commerce/WooCommerce/Main.php

	public function attendee_decreases_inventory( array $attendee ) {

		$order_id = Tribe__Utils__Array::get( $attendee, 'order_id' );

		$order = wc_get_order( $order_id );

		// Bail if the order is empty, return true to decrease attendees.
		if ( empty( $order ) ) {
			return true;
		}

		// For cancelled orders inventory is restocked, so we should not decrease inventory for this case.
		if ( 'cancelled' === $order->get_status() ) {
			return false;
		}

		// For refunded orders inventory is not restocked automatically, we should only decrease if the order was not restocked.
		if ( 'refunded' === $order->get_status() && tribe_is_truthy( $order->get_meta( $this->restocked_refunded_order ) ) ) {
			// Don't count the attendee if the refunded order was restocked.
			return false;
		}

		return true;
	}

Top ↑

Changelog

Changelog
Version Description
5.2.5 Introduced.