// just pass in the attribute and the attribute slug // and the return value is the attribute's name // example : (assuming attribute size has the option of "Extra Small" withe the slug of "extra-small") // echo attribute_slug_to_title('attribute_pa_size', 'extra-small'); // returns // "Extra Small" // code reworked from woocommerce/classes/class-wc-cart.php // attribute slug to title if ( ! function_exists( 'attribute_slug_to_title' ) ) { function attribute_slug_to_title( $attribute ,$slug ) { global $woocommerce; if ( taxonomy_exists( esc_attr( str_replace( 'attribute_', '', $attribute ) ) ) ) { $term = get_term_by( 'slug', $slug, esc_attr( str_replace( 'attribute_', '', $attribute ) ) ); if ( ! is_wp_error( $term ) && $term->name ) $value = $term->name; } else { $value = apply_filters( 'woocommerce_variation_option_name', $value ); } return $value; } }