Answer the question
In order to leave comments, you need to log in
How to get data from this array?
The woocommerce plugin is trying to get the name of the product but it does not work, I tried in such ways.
Please tell me how can I get it?
echo $data['data:protected']['name'];
echo $data->'data:protected'->name;
echo $data->data:protected->name;
WC_Product_Simple Object
(
[object_type:protected] => product
[post_type:protected] => product
[cache_group:protected] => products
[data:protected] => Array
(
[name] => Panton tunior chair //Нужно получить это
[slug] => panton-tunior-chair
[date_created] => WC_DateTime Object
(
[utc_offset:protected] => 10800
[date] => 2017-06-14 08:24:57.000000
[timezone_type] => 1
[timezone] => +00:00
)
Answer the question
In order to leave comments, you need to log in
There are corresponding methods for getting data from the given object's data array
$product_type = $data->get_type();
$product_id = $data->get_id();
$product_name = $data->get_name();
$product_sku = $data->get_sku();
$product_price = $data->get_price();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question