I'm trying to get the product attributes. I can dig into the objects like this but I get stuck here: How would I get the value 1500?
Thanks
$bundle = new WC_Product_Bundle($post->ID);
$products = $bundle->get_bundled_items();
foreach ($products as $product) {
var_dump($product->{'product'}->{'attributes'});
array(1) {
["energy"]=>
object(WC_Product_Attribute)#1402 (1) {
["data":protected]=>
array(6) {
["id"]=>
int(0)
["name"]=>
string(6) "energy"
["options"]=>
array(1) {
[0]=>
string(4) "1500"
}
["position"]=>
int(0)
["visible"]=>
bool(true)
["variation"]=>
bool(false)
}
}
}