wc_get_attribute_types()WC 2.4.0

Get attribute types.

Хуки из функции

Возвращает

Массив.

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

wc_get_attribute_types();

Список изменений

С версии 2.4.0 Введена.

Код wc_get_attribute_types() WC 11.0.1

function wc_get_attribute_types() {
	$attribute_types = array(
		'select' => __( 'Text', 'woocommerce' ),
	);

	$allow_visual_attribute_type =
		wp_is_block_theme() &&
		FeaturesUtil::feature_is_enabled( 'wc-visual-attribute' );

	// If the store already has some visual attributes, let's allow them even
	// if the current theme is not a block theme.
	if ( ! $allow_visual_attribute_type ) {
		foreach ( wc_get_attribute_taxonomies() as $attribute_taxonomy ) {
			if ( isset( $attribute_taxonomy->attribute_type ) && 'wc-visual' === $attribute_taxonomy->attribute_type ) {
				$allow_visual_attribute_type = true;
				break;
			}
		}
	}

	if ( $allow_visual_attribute_type ) {
		$attribute_types['wc-visual'] = __( 'Color / image', 'woocommerce' );
	}

	return (array) apply_filters(
		'product_attributes_type_selector',
		$attribute_types
	);
}