Answer the question
In order to leave comments, you need to log in
How to get the attribute name of a simple product in the cart?
I get attributes like this:
$attributes = $cart_item['data'];
$attributes_items = $attributes->get_attributes();
foreach ( $attributes_items as $attributes_key => $attributes_item ) {
if ( $attributes_item['name'] == 'pa_tsveta' ) {
$terms = get_term_by( 'slug', $attributes_item, $attributes_key );
echo 'Цвет: ' . $terms ->name;
}
}
Object of class WC_Product_Attribute could not be converted to string
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question