Merge pull request #14489 from woocommerce/fix/14469

Remove attribute_ prefix from names in wc_get_formatted_variation
This commit is contained in:
Claudio Sanches 2017-04-18 18:39:21 -03:00 committed by GitHub
commit 58b7b82ee1
1 changed files with 7 additions and 1 deletions

View File

@ -341,8 +341,14 @@ function wc_get_formatted_variation( $variation, $flat = false, $include_names =
$variation_attributes = $variation->get_attributes();
$product = $variation;
} else {
$variation_attributes = $variation;
$product = false;
// Remove attribute_ prefix from names.
$variation_attributes = array();
if ( is_array( $variation ) ) {
foreach ( $variation as $key => $value ) {
$variation_attributes[ str_replace( 'attribute_', '', $key ) ] = $value;
}
}
}
$list_type = $include_names ? 'dl' : 'ul';