php - WooCommerce product - Displaying post_content value of product object -


when use:

print_r($product);  

it returns 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 picture               ..... 

how echo out value [post_content]?

i using wordpress woocommerce plugin.

thanks.

as can see $product object contains post object (and not arrays). try 1 of this:

$product_content = $product->post->post_content; echo $product_content; // or directly // echo $product->post->post_content; 

or 1 should work too:

$_product = $product->post; echo $_product->post_content; 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -