wc_attribute_taxonomy_id_by_name()WC 2.6.0

Get a product attribute ID by name.

No Hooks.

Return

Int.

Usage

wc_attribute_taxonomy_id_by_name( $name );
$name(string) (required)
Attribute name.

Changelog

Since 2.6.0 Introduced.

wc_attribute_taxonomy_id_by_name() code WC 8.7.0

function wc_attribute_taxonomy_id_by_name( $name ) {
	$name         = wc_attribute_taxonomy_slug( $name );
	$taxonomy_ids = wc_get_attribute_taxonomy_ids();

	return isset( $taxonomy_ids[ $name ] ) ? $taxonomy_ids[ $name ] : 0;
}