Merge pull request #26022 from grey-rsi/wc_attribute_label_filter

Always pass attribute name to a 'woocommerce_attribute_label' filter
This commit is contained in:
Christopher Allford 2020-05-11 19:36:44 -07:00 committed by GitHub
commit cb7f89a5ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -185,9 +185,9 @@ function wc_attribute_taxonomy_id_by_name( $name ) {
*/
function wc_attribute_label( $name, $product = '' ) {
if ( taxonomy_is_product_attribute( $name ) ) {
$name = wc_attribute_taxonomy_slug( $name );
$slug = wc_attribute_taxonomy_slug( $name );
$all_labels = wc_get_attribute_taxonomy_labels();
$label = isset( $all_labels[ $name ] ) ? $all_labels[ $name ] : $name;
$label = isset( $all_labels[ $slug ] ) ? $all_labels[ $slug ] : $slug;
} elseif ( $product ) {
if ( $product->is_type( 'variation' ) ) {
$product = wc_get_product( $product->get_parent_id() );