Tribe__Tickets_Plus__Commerce__EDD__Main::add_ticket_to_cart( int $ticket_id, int $quantity )
Handles the process of adding a ticket product to the cart.
Contents
If the cart contains a line item for the product, this will add the quantity to the existing quantity. If the quantity is zero and the cart contains a line item for the product, this will remove it.
See also
- bug: #28917
Parameters
- $ticket_id
-
(int) (Required) Ticket ID.
- $quantity
-
(int) (Required) Ticket quantity.
Source
File: src/Tribe/Commerce/EDD/Main.php
public function add_ticket_to_cart( $ticket_id, $quantity ) {
/** @var \Tribe__Tickets_Plus__Commerce__EDD__Cart $cart */
$cart = tribe( 'tickets-plus.commerce.edd.cart' );
$existing_quantity = edd_get_cart_item_quantity( $ticket_id );
$quantity += $existing_quantity;
return $cart->add_ticket_to_cart( $ticket_id, $quantity );
}