Merge pull request #13252 from woocommerce/fix-13244

Check the nicename, not the sanitized name
This commit is contained in:
Claudio Sanches 2017-02-20 16:52:39 -03:00 committed by GitHub
commit 93dac70fc2
1 changed files with 6 additions and 5 deletions

View File

@ -542,10 +542,6 @@ class WC_Cart {
// This is because variation titles display the attributes.
if ( $cart_item['data']->is_type( 'variation' ) && is_array( $cart_item['variation'] ) ) {
foreach ( $cart_item['variation'] as $name => $value ) {
if ( '' === $value || stristr( $cart_item['data']->get_name(), $value ) ) {
continue;
}
$taxonomy = wc_attribute_taxonomy_name( str_replace( 'attribute_pa_', '', urldecode( $name ) ) );
// If this is a term slug, get the term's nice name
@ -556,12 +552,17 @@ class WC_Cart {
}
$label = wc_attribute_label( $taxonomy );
// If this is a custom option slug, get the options name
// If this is a custom option slug, get the options name.
} else {
$value = apply_filters( 'woocommerce_variation_option_name', $value );
$label = wc_attribute_label( str_replace( 'attribute_', '', $name ), $cart_item['data'] );
}
// Check the nicename against the title.
if ( '' === $value || stristr( $cart_item['data']->get_name(), $value ) ) {
continue;
}
$item_data[] = array(
'key' => $label,
'value' => $value,