WooCommerce Code Reference

AgenticCheckoutSession
in package

AgenticCheckoutSession class.

Wrapper for all things, associated with an agentic checkout session. This class manages the cart and error handling for agentic checkout processes.

Table of Contents

$cart  : WC_Cart
The WooCommerce cart instance.
$id  : string
The checkout session ID.
$messages  : Messages
Error messages handler for the checkout session.
__construct()  : mixed
Constructor.
get_cart()  : WC_Cart
Gets the cart instance.
get_id()  : string
Gets the checkout session ID.
get_messages()  : Messages
Gets the messages collection.
get_or_set_checkout_session_id()  : string
Get the checkout session ID. If it does not exist, generate a cart token for it and save to the current session.

Properties

Methods

get_or_set_checkout_session_id()

Get the checkout session ID. If it does not exist, generate a cart token for it and save to the current session.

private get_or_set_checkout_session_id() : string
Return values
stringCheckout Session ID stored in the current session.