WooCommerce Code Reference

DocumentObject
in package

DocumentObject class.

This will combine and format given cart/customer/checkout data into a standard object format that can be queried through JSON. This is used for conditional fields and validation during checkout.

Table of Contents

$cart  : WC_Cart|null
The cart object.
$cart_controller  : CartController
Cart controller class instance.
$context  : null|string
Docuemnt object context which may adjust the schema response.
$customer  : WC_Customer|null
The customer object.
$request_data  : array<string|int, mixed>
The request data.
$schema_controller  : SchemaController
Schema controller class instance.
$valid_contexts  : array<string|int, mixed>
Valid contexts.
__construct()  : mixed
The constructor.
get_context()  : null|string
Get the current context.
get_data()  : array<string|int, mixed>
Get the data for the document object.
set_cart()  : mixed
Set the cart object.
set_context()  : mixed
Set document object context.
set_customer()  : mixed
Set the customer object.
get_cart_data()  : array<string|int, mixed>
Gets a subset of cart data.
get_checkout_data()  : array<string|int, mixed>
Get checkout data.
get_customer_data()  : array<string|int, mixed>
Get the customer data.

Properties

Methods

get_data()

Get the data for the document object.

public get_data() : array<string|int, mixed>

This isn't a 1:1 match with Store API because some data is simplified to make it easier to parse as JSON.

Return values
array<string|int, mixed>The data for the document object.