Automattic\WooCommerce\Internal\RestApi\Routes\V4\Settings\Products\Schema
ProductSettingsSchema::normalize_field_type
Normalize WooCommerce field types to REST API field types.
Method of the class: ProductSettingsSchema{}
No Hooks.
Returns
String. Normalized field type.
Usage
// private - for code of main (parent) class only $result = $this->normalize_field_type( $wc_type ): string;
- $wc_type(string) (required)
- WooCommerce field type.
ProductSettingsSchema::normalize_field_type() ProductSettingsSchema::normalize field type code WC 10.4.3
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;
}