Jump to content
jimleeder123

WordPress - Get product info from the order on the e-mail template

Recommended Posts

I'm editing the e-mail templates on WordPress. I want to be able to get the product info from the order that the e-mail is about, so I can do stuff with it.

 

I need the product name/title, and can go on with it from there. Any help greatly appreciated.

Share this post


Link to post
Share on other sites

We're going to need a lot more information than this to help at all.

 

What theme are you using? Have you created a child theme (you should have, if you're editing the files)? What e-commerce plugin are you using? Have you read the documentation for the theme and plugin?

Share this post


Link to post
Share on other sites

Sorry, I'm using WooCommerce, and my own custom theme. I'm trying to enter this into the admin order e-mail file, and will carry it into the customer one later when ready.

 

I've googled a lot and tried a lot, but nothings working. What I need is the product name(s) in the order. Because of the nature of the business, it's likely only one product will be bought (or multiple of a single product).

Share this post


Link to post
Share on other sites

I've not got a lot of experience with WooCommerce, but what I've found is that the product is a custom post type. Have you tried "get_posts( [productID] )"? It should return a WP_Post object - the post_title attribute should be the product name.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.