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

Increase the sales for a ticket by a specific quantity.


Parameters

$ticket_id

(int) (Required) The ticket post ID.

$quantity

(int) (Optional) The quantity 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/Tickets/Commerce/Ticket.php

	public function increase_ticket_sales_by( $ticket_id, $quantity = 1, $shared_capacity = false, $global_stock = null ) {
		// Adjust sales.
		$sales = (int) get_post_meta( $ticket_id,  static::$sales_meta_key, true ) + $quantity;

		update_post_meta( $ticket_id,  static::$sales_meta_key, $sales );

		if (  'own' !== $shared_capacity && $global_stock instanceof \Tribe__Tickets__Global_Stock ) {
			$this->update_global_stock( $global_stock, $quantity );
		}

		return $sales;
	}

Top ↑

Changelog

Changelog
Version Description
5.13.3 Modified logic when updating global stock.
5.1.9 Introduced.