1

How to display main product description on the cart page? I tried this but it works only for variation description.

$_product->description

I want to display the main description which is the same for all variations.

1

$_product object is product variation object.

You have to first get the parent product id and then get the description of parent product.

$parent_product_id =$_product->get_parent_id();
$parent_product = get_post($parent_product_id);
echo $content = $parent_product->post_content;

Or

 echo $_product->parent->description;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.