WooCommerce Code Reference

Validation
in package

Service class validating checkout field schema.

Table of Contents

$meta_schema_json  : string
Meta schema.
get_field_schema_with_context()  : array<string|int, mixed>
Get the field schema with context.
has_field_schema()  : bool
Check if the fields have defined schema.
is_valid_schema()  : bool|WP_Error
Validate meta schema for field rules.
validate_document_object()  : bool|WP_Error
Validate the field rules.

Properties

Methods

get_field_schema_with_context()

Get the field schema with context.

public static get_field_schema_with_context(string $field_id, array<string|int, mixed> $field_schema, string $context) : array<string|int, mixed>
Parameters
$field_id : string

The field ID.

$field_schema : array<string|int, mixed>

The field schema.

$context : string

The context.

Return values
array<string|int, mixed>

is_valid_schema()

Validate meta schema for field rules.

public static is_valid_schema(array<string|int, mixed> $rules) : bool|WP_Error
Parameters
$rules : array<string|int, mixed>

The field rules.

Return values
bool|WP_ErrorTrue if the field options are valid, a WP_Error otherwise.