WooCommerce Code Reference

CheckoutFieldsAdmin
in package

Service class managing checkout fields and its related extensibility points in the admin area.

Table of Contents

$checkout_fields_controller  : CheckoutFields
Checkout field controller.
__construct()  : mixed
Sets up core fields.
admin_address_fields()  : array<string|int, mixed>
Injects address fields in WC admin orders screen.
admin_contact_fields()  : array<string|int, mixed>
Injects contact fields in WC admin orders screen.
admin_order_fields()  : array<string|int, mixed>
Injects additional fields in WC admin orders screen.
init()  : mixed
Initialize hooks. This is not run Store API requests.
update_callback()  : mixed
Updates a field value for an order.
format_field_for_meta_box()  : array<string|int, mixed>
Converts the shape of a checkout field to match whats needed in the WooCommerce meta boxes.

Properties

Methods

admin_address_fields()

Injects address fields in WC admin orders screen.

public admin_address_fields(array<string|int, mixed> $fields[, WC_Order|bool $order = null ][, string $context = 'edit' ]) : array<string|int, mixed>
Parameters
$fields : array<string|int, mixed>

The fields to show.

$order : WC_Order|bool = null

The order to show the fields for.

$context : string = 'edit'

The context to show the fields for.

Return values
array<string|int, mixed>

admin_contact_fields()

Injects contact fields in WC admin orders screen.

public admin_contact_fields(array<string|int, mixed> $fields[, WC_Order|bool $order = null ][, string $context = 'edit' ]) : array<string|int, mixed>
Parameters
$fields : array<string|int, mixed>

The fields to show.

$order : WC_Order|bool = null

The order to show the fields for.

$context : string = 'edit'

The context to show the fields for.

Return values
array<string|int, mixed>

admin_order_fields()

Injects additional fields in WC admin orders screen.

public admin_order_fields(array<string|int, mixed> $fields[, WC_Order|bool $order = null ][, string $context = 'edit' ]) : array<string|int, mixed>
Parameters
$fields : array<string|int, mixed>

The fields to show.

$order : WC_Order|bool = null

The order to show the fields for.

$context : string = 'edit'

The context to show the fields for.

Return values
array<string|int, mixed>

update_callback()

Updates a field value for an order.

public update_callback(string $key, mixed $value, WC_Order $order) : mixed
Parameters
$key : string

The field key.

$value : mixed

The field value.

$order : WC_Order

The order to update the field for.

Return values
mixed

format_field_for_meta_box()

Converts the shape of a checkout field to match whats needed in the WooCommerce meta boxes.

protected format_field_for_meta_box(array<string|int, mixed> $field, string $key) : array<string|int, mixed>
Parameters
$field : array<string|int, mixed>

The field to format.

$key : string

The field key. This will be used for the ID of the field when passed to the meta box.

Return values
array<string|int, mixed>Formatted field.