Skip to content

Cart & Checkout

Cart & Checkout

When a visitor selects tickets on an event page, those tickets go into a session-based cart that holds availability for a limited time. The checkout flow validates the cart, collects buyer information, processes payment, creates the order and attendee records, and sends a confirmation email. This page covers how the cart works internally and what happens at each step of checkout.

How the Cart Works

The cart stores ticket selections as WordPress transients, keyed by a session token. When a visitor first adds a ticket, Tickets Please sets a cookie called tec_cart_token with a unique identifier. This cookie lasts 24 hours. The transient data associated with that token contains the items currently in the cart.

Each cart item stores five pieces of data:

FieldDescription
ticket_idThe ID of the ticket post being purchased
event_idThe ID of the event the ticket belongs to
quantityHow many of this ticket the buyer selected
priceThe price per ticket at the time it was added
nameThe ticket name for display purposes

Because the cart uses transients rather than database tables, it works with any WordPress caching backend and does not require custom database tables.

Cart Hold Time

When tickets are added to a cart, they are temporarily held against the ticket’s available capacity. The default hold time is 30 minutes. After the hold expires, the tickets are released back into the available pool.

You can change the hold time with the tickets_please_cart_hold_time filter:

add_filter( 'tickets_please_cart_hold_time', function ( $seconds ) {
return 45 * MINUTE_IN_SECONDS; // 45 minutes
} );

A cron job registered under the tec_cart_cleanup hook runs periodically to clear expired cart transients and release held capacity. This runs automatically and does not require any configuration.

Adding Tickets to the Cart

The add-to-cart process uses AJAX to validate capacity in real time before confirming the addition. The JavaScript in assets/js/add-to-cart.js handles the frontend interaction.

When a buyer clicks Add to Cart on the event page:

  1. The JavaScript sends an AJAX request with the ticket ID and requested quantity.
  2. The server checks current available capacity, accounting for tickets already held in other carts.
  3. If capacity is available, the item is added to the cart transient and a success response is returned.
  4. If capacity is insufficient, the buyer sees an inline error message with the number of tickets still available.

This real-time validation prevents overselling even when multiple buyers are shopping at the same time.

Cart REST API

The cart exposes a full set of REST endpoints for headless or custom frontend implementations:

MethodEndpointDescription
GET/tribe/tickets/v1/cartRetrieve current cart contents
POST/tribe/tickets/v1/cartAdd an item to the cart
PUT/tribe/tickets/v1/cartUpdate item quantity
DELETE/tribe/tickets/v1/cartRemove an item from the cart

All endpoints use the tec_cart_token cookie for session identification. If no token exists, a POST request creates one.

Checkout Flow

Checkout is rendered by the [tec_tickets_checkout] shortcode. Place this shortcode on any WordPress page. The checkout process follows these steps:

  1. Cart validation — the system re-checks ticket availability and confirms prices have not changed since the items were added.
  2. Buyer information — the buyer enters their name and email address. If the buyer is logged in, these fields are pre-filled from their WordPress user profile.
  3. Payment method — the buyer selects from the active payment gateways. If only one gateway is active, it is selected automatically.
  4. Payment processing — the selected gateway processes the payment. For Stripe, this happens inline with Stripe Elements. For PayPal, the buyer completes payment through the PayPal flow.
  5. Order creation — a tec_tc_order post is created with the order details, buyer information, and payment reference.
  6. Attendee creation — one tec_tc_attendee record is created per ticket per quantity. If the buyer purchased 3 General Admission tickets, 3 attendee records are created.
  7. Capacity update — the ticket’s available capacity is decremented by the total quantity purchased.
  8. Confirmation email — an email is sent to the buyer with the order summary, event details, and calendar links.
  9. Redirect — the buyer is redirected to the order confirmation page with their order details.

If validation fails at step 1 (a ticket sold out while the buyer was checking out), the buyer is returned to the cart with a message explaining which items are no longer available.

Checkout Without WooCommerce

The [tec_tickets_checkout] shortcode provides a standalone checkout experience that does not require WooCommerce. Tickets Please processes payments directly through its own gateway integrations. If you prefer to route purchases through WooCommerce’s cart and checkout instead, see WooCommerce Integration.

Common Questions

How long do tickets stay in the cart? By default, 30 minutes. After that, the hold expires and the tickets return to the available pool. You can adjust this with the tickets_please_cart_hold_time filter.

What happens if the buyer closes their browser? The tec_cart_token cookie persists for 24 hours, so if the buyer returns on the same browser, their cart is still there (assuming the hold time has not expired). After the hold expires, the items are gone.

Can a buyer mix tickets from different events in one cart? Yes. The cart supports tickets from multiple events in a single checkout. Each attendee record is linked to its respective event.

Does the cart work with caching plugins? Yes. Because the cart uses transients and identifies sessions by cookie, it is compatible with full-page caching. The AJAX add-to-cart requests bypass page caches by default.

Can I disable the built-in checkout and use only WooCommerce? Yes. Simply do not place the [tec_tickets_checkout] shortcode on any page and enable the WooCommerce integration. All paid ticket purchases will route through WooCommerce’s checkout.

Where is the cart data stored? In WordPress transients, which use the wp_options table by default. If you have a persistent object cache (Redis, Memcached), transients are stored there instead, which is faster.

Next Steps