When I use:
print_r($product);
It returns the following:
WC_Product_Simple
Object
( [id] => 156
[post] => WP_Post Object
( [ID] => 156
[post_author] => 1
[post_date] => 2016-07-01 08:59:05
[post_date_gmt] => 2016-07-01 06:59:05
[post_content] => single product with picture
.....
How do I echo out the value for [post_content]?
I am using WordPress with WooCommerce plugin.
Thanks.
As you can see your $product is an object that contains a post object (and not arrays). So you could try one of this:
$product_content = $product->post->post_content;
echo $product_content;
// or directly
// echo $product->post->post_content;
or this one should work too:
$_product = $product->post;
echo $_product->post_content;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With