Tribe__Tickets_Plus__Commerce__EDD__Cart::get_tickets_in_cart( array $tickets = array(), string $provider = null )
Get all tickets currently in the cart.
Contents
Parameters
- $tickets
-
(array) (Optional) List of tickets.
Default value: array()
- $provider
-
(string) (Optional) Provider of tickets to get (if set).
Default value: null
Return
(array) List of tickets.
Source
File: src/Tribe/Commerce/EDD/Cart.php
public function get_tickets_in_cart( $tickets = array() ) {
$contents = edd_get_cart_contents();
if ( empty( $contents ) ) {
return $tickets;
}
foreach ( $contents as $item ) {
$edd_check = get_post_meta( $item['id'], tribe( 'tickets-plus.commerce.edd' )->event_key, true );
if ( empty( $edd_check ) ) {
continue;
}
$tickets[ $item['id'] ] = $item['quantity'];
}
return $tickets;
}
Changelog
| Version | Description |
|---|---|
| 4.9 | Introduced. |