Tribe__Tickets__Commerce__PayPal__Main::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.
Contents
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
Return
(int) The new sales amount.
Source
File: src/Tribe/Commerce/PayPal/Main.php
public function increase_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', $sales + $qty );
if ( $shared_capacity && $global_stock instanceof Tribe__Tickets__Global_Stock ) {
$this->update_global_stock( $global_stock, $qty );
}
return $sales;
}
Changelog
| Version | Description |
|---|---|
| 4.7 | |
| 4.10.2 | Introduced. |