Skip to content

Commit

Permalink
Refactor to get the first element independently of its key
Browse files Browse the repository at this point in the history
  • Loading branch information
puntope committed Apr 11, 2023
1 parent b1623a6 commit e4511c5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Product/WCProductAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,9 @@ protected function get_product_taxonomy( $taxonomy ) {
return null;
}

return wp_list_pluck( $values, 'name' )[0];
$term_names = wp_list_pluck( $values, 'name' );
$term_name = reset( $term_names );
return $term_name ?: null;
}

/**
Expand Down

0 comments on commit e4511c5

Please sign in to comment.