I am trying to show attribute type and variation on my custom made minicart in woocommerce. I use WC()->cart->cart_contents[ $item ]; to get cart item object. and using wc_implode_text_attributes() to extract value from array where $variation_name return name but not attribute.
Attribute = color variation = green , red , yellow
So I want output should be like
color:green
but the current output is only showing
green
$cart_item = WC()->cart->cart_contents[ $item ];
if( $cart_item['data']->is_type( 'variation' ) ){
$attributes = $cart_item['data']->get_attributes();
$variation_name = wc_implode_text_attributes( $attributes );
var_dump( $attributes);
}
The dump result is
array(1) { ["color"]=> string(5) "green" }
So how Can I extract this dump like color:green ?