Cart::remove_ticket( int $ticket_id, int $quantity = 1 )

Handles the process of adding a ticket product to the cart.

If the cart contains a line item for the product, this will replace the previous quantity. If the quantity is zero and the cart contains a line item for the product, this will remove it.


Parameters

$ticket_id

(int) (Required) Ticket ID.

$quantity

(int) (Optional) Ticket quantity to remove.

Default value: 1


Top ↑

Source

File: src/Tickets/Commerce/Cart.php

	public function remove_ticket( $ticket_id, $quantity = 1 ) {
		$cart = $this->get_repository();

		// Enforces that the min to remove is 1.
		$quantity = max( 1, (int) $quantity );

		$cart->remove_item( $ticket_id, $quantity );
	}

Top ↑

Changelog

Changelog
Version Description
5.1.9 Introduced.