Created
August 17, 2023 15:47
-
-
Save elias1435/cf1ec6f0df33791b3b6056447d3f78df to your computer and use it in GitHub Desktop.
How to display acf product field in woocommerce order email. ACF field name is 'customer_email' and its location is product. blow code will go to functions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_order_item_meta_end', 'custom_product_info', 20, 4 ); | |
function custom_product_info ( $item_id, $item, $order, $plain_text ) { | |
$id = $item->get_product_id(); | |
$product_info = get_field('customer_email',$id); | |
if($product_info){ | |
echo "<p>Customer Message: $product_info</p>"; | |
}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment