4

I created an advanced custom field with the ACF plugin to add additional information on the Woocommerce product edit page. It's a subtitle that differentiates t-shirt templates. I was able to make the value appear on the product page front-end, but I need this information to appear in the order details and all emails, perhaps as order meta. Thanks in advance.

Kelvin Mariano
  • 991
  • 8
  • 15

1 Answers1

2

This is brilliant and the only place I've ever found this answer! I might have to spread it around! :)

I'm getting this to work on a site I'm developing as well - the code has no bugs.

Just a few additional pointers on the code:

  • where is says "woo_title", that is where you put the name of your field

  • In the code where it says "ACF value:" and "acf", change those to titles that make sense to the data you are trying to display to the customer (like Date or Style)

  • In addition to the last point, there is no need to add ":" after your field's title, Woocommerce will insert a colon

  • When you add your test product to the cart and do a test checkout, if you are testing and changing the field title as I've been talking about above, you can't see your changes by simply refreshing the cart screen, you'll have to empty your cart, change the function code, change what you entered into the custom field in the ACF field to make the product data in the database update, then hit update on the product/post, then go through the process of adding it to the cart and checking out to see your update - hopefully that makes sense!

Scott Kasprick
  • 21
  • 1
  • 1
  • 2
  • For the second part of the script, "Display Acf value in order detail page after order table", do you know which order detail page is this referring to? Cannot seem to find where it is displayed. Thank you for your additional pointers. – Ammar Faris Apr 27 '22 at 21:24