How do you access the Product Short Description in a WooCommerce email template? [closed]
IT Nursery
April 17, 2022
0
I would like to output the Product Short Description beneath the product name inside the order items table inside WooCommerce emails. I think I know where to place code inside the email template file, but I don’t know how to access the description of an item. I don’t see any mechanism to retrieve it. What do I need to do to echo out the field?
Thanks in advance!
1 1
I finally tried using var_dump() on $item and $_product, which are both used in the email-order-items.php template. $_product revealed a post object, which itself has a post_excerpt property, which looks like it holds the contents of the “Product Short Description” from the WooCommerce product form.
So, to add the description beneath the item name, I added this to my code:
echo '<br/>' . $_product->post->post_excerpt;
Voilà! The short description appears in the email!
Hope this helps someone else! Took me a couple hours of frustration to get it.