Tribe__Tickets__Commerce__PayPal__Main::decrease_ticket_sales_by( int $ticket_id, int $quantity = 1, bool $shared_capacity = false, Tribe__Tickets__Global_Stock|null $global_stock = null )

Decrease the sales for a ticket by a specific quantity.


Parameters

$ticket_id

(int) (Required) The ticket post ID.

$quantity

(int) (Optional) The quanitity to increase the ticket sales by.

Default value: 1

$shared_capacity

(bool) (Optional) Whether the ticket is using shared capacity.

Default value: false

$global_stock

(Tribe__Tickets__Global_Stock|null) (Optional) The stock object or null.

Default value: null


Top ↑

Return

(int) The new sales amount.


Top ↑

Source

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

	public function decrease_ticket_sales_by( $ticket_id, $qty = 1, $shared_capacity = false, $global_stock = null ) {
		$sales = (int) get_post_meta( $ticket_id, 'total_sales', true );
		update_post_meta( $ticket_id, 'total_sales', max( $sales - $qty, 0 ) );

		if ( $shared_capacity && $global_stock instanceof Tribe__Tickets__Global_Stock ) {
			$this->update_global_stock( $global_stock, $qty, true );
		}
	}

Top ↑

Changelog

Changelog
Version Description
4.7
4.10.2 Introduced.