WooCommerce Code Reference

WC_REST_General_Settings_V4_Controller extends WC_REST_V4_Controller
in package

REST API General Settings controller class.

Tags
extends

WC_REST_V4_Controller

Table of Contents

$namespace  : string
Endpoint namespace.
$rest_base  : string
Route base.
$settings_general_instance  : WC_Settings_General
WC_Settings_General instance.
get_item()  : WP_REST_Response|WP_Error
Get general settings.
get_item_permissions_check()  : bool|WP_Error
Check permissions for reading general settings.
get_item_schema()  : array<string|int, mixed>
Get the schema for general settings, conforming to JSON Schema.
prepare_response_for_collection()  : array<string|int, mixed>
Prepare a response for inserting into a collection.
register_routes()  : mixed
Register routes.
update_item()  : WP_REST_Response|WP_Error
Update general settings.
update_item_permissions_check()  : bool|WP_Error
Check permissions for updating general settings.
check_permissions()  : bool|WP_Error
Check permissions for a given request.
get_api_version()  : string
Get the default REST API version.
get_base_schema()  : array<string|int, mixed>
Get the base schema for the API.
get_country_state_options()  : array<string|int, mixed>
Get country/state options for single select country field.
get_currency_options()  : array<string|int, mixed>
Get currency options.
get_field_options()  : array<string|int, mixed>
Get options for specific field types.
get_field_schema()  : array<string|int, mixed>
Get the schema for individual setting fields.
get_general_settings_data()  : array<string|int, mixed>
Get general settings data by transforming WC_Settings_General data into REST API format.
get_group_order()  : int
Get the display order for a settings group.
get_settings_general_instance()  : WC_Settings_General
Get the WC_Settings_General instance.
get_update_args()  : array<string|int, mixed>
Get update arguments for the endpoint.
normalize_field_type()  : string
Normalize WooCommerce field types to REST API field types.
sanitize_setting_value()  : mixed
Sanitize setting value based on its type.
transform_setting_to_field()  : array<string|int, mixed>|null
Transform a WooCommerce setting into REST API field format.
validate_country_or_state_code()  : bool
Validate country or state code.
validate_setting_value()  : bool|WP_Error
Validate a setting value before updating.

Properties

Methods

prepare_response_for_collection()

Prepare a response for inserting into a collection.

public prepare_response_for_collection(WP_REST_Response $response) : array<string|int, mixed>
Parameters
$response : WP_REST_Response

Response object.

Return values
array<string|int, mixed>Response data.

check_permissions()

Check permissions for a given request.

protected check_permissions(WP_REST_Request $request[, string $permission = 'read' ]) : bool|WP_Error
Parameters
$request : WP_REST_Request

Full details about the request.

$permission : string = 'read'

The permission to check for.

Return values
bool|WP_Error