Automattic\WooCommerce\Internal\RestApi\Routes\V4\Settings\Products\Schema

ProductSettingsSchema::normalize_field_typeprivateWC 1.0

Normalize WooCommerce field types to REST API field types.

Метод класса: ProductSettingsSchema{}

Хуков нет.

Возвращает

Строку. Normalized field type.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->normalize_field_type( $wc_type ): string;
$wc_type(строка) (обязательный)
WooCommerce field type.

Код ProductSettingsSchema::normalize_field_type() WC 10.5.2

private function normalize_field_type( string $wc_type ): string {
	$type_map = array(
		'single_select_product' => 'select',
		'multi_select_product'  => 'multiselect',
	);

	return $type_map[ $wc_type ] ?? $wc_type;
}