Fix #32542
Order again item meta should store term slug instead of term value. In case `taxonomy_is_product_attribute( $meta->key )` is true, `$meta->value` is the term slug, therefore we can refactor the if statement using the condition `taxonomy_is_product_attribute( $meta->key ) || meta_is_product_attribute( $meta->key, $meta->value, $product_id )`, assign `$variations[ $meta->key ] = $meta->value`, and drop the `else` statement.
This commit is contained in:
parent
aaa20f556b
commit
f26e62502c
|
@ -371,12 +371,9 @@ final class WC_Cart_Session {
|
|||
if ( ! $product->is_in_stock() ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
foreach ( $item->get_meta_data() as $meta ) {
|
||||
if ( taxonomy_is_product_attribute( $meta->key ) ) {
|
||||
$term = get_term_by( 'slug', $meta->value, $meta->key );
|
||||
$variations[ $meta->key ] = $term ? $term->name : $meta->value;
|
||||
} elseif ( meta_is_product_attribute( $meta->key, $meta->value, $product_id ) ) {
|
||||
if ( taxonomy_is_product_attribute( $meta->key ) || meta_is_product_attribute( $meta->key, $meta->value, $product_id ) ) {
|
||||
$variations[ $meta->key ] = $meta->value;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue