I try to get the names of the variable product attributes names that is in the cart but something is wrong. i don't understand how i can get the variation value when an object is protected
foreach ( $order->get_items() as $item_id => $item ) {
$product_id = $item->get_product_id();
$product = $item->get_product();
$accomodation = $product['variation']['attribute_pa_hebergement']; // does not work
}
This is a part of the object reurns in $product
WC_Product_Variation Object
(
[post_type:protected] => product_variation
[parent_data:protected] => Array
(
[title] => test
[status] => publish
[sku] =>
[tax_class] =>
[shipping_class_id] => 0
)
[object_type:protected] => product
[cache_group:protected] => products
[data:protected] => Array
(
[name] => test
[slug] => test-14
...
[attributes] => Array
(
[pa_hebergement] => chambre-double-140e
[pa_parking] => 1-place-35e
[pa_tarifs] => tarif-jeune
)
[default_attributes] => Array
(
)