how can get specific key and its value from object

Rate this post

How do I get specific key and its value from object?

Example I have output of my query:

"attribute_summary":"Color: Red",
         "value":"278 x 138 x 80 mm"
         "value":"1m2 \/ 26tk"
         "value":"8,6 m2 \/ 224 tk \/ 1350 kg"
         "value":"1200 x 1200 mm"

And I know if I query like this $product->attribute_summary; I can get data Color: Red

But How do I get data of meta_data? Like need to get key _alus_al and its value displayed.



If you’re talking WooCommerce here. The way to get the specific meta value from the $product Object is simply.

add_action('your_action', function(){
   global $product;
   $meta_data = $product->get_meta('your_meta_key'));

Leave a Reply

Your email address will not be published.

Back to top button