admin管理员组

文章数量:1415139

I am using / plugin in WooCommerce and I have set a custom field named "sub_domain". I am trying to display the value of this custom field in the Woocommerce template woocommerce/emails/customer-completed-order.php After some research on the internet i found and used that code in to the woocommerce/emails/customer-completed-order.php but it isn't working as like i expected:


<?php 
// Get the $order ID (WooCommerce version compatibility) 
if ( version_compare( WC_VERSION, '3.0', '<' ) ) { 
$order_id = int_val( $order->id ); // Older than 3.0 
} else { $order_id = int_val( $order->get_id() ); // 3.0+ 
} $domain = get_field('sub_domain', $order_id );
if( $domain ){ echo '<p>' . $domain . '</p>'; } 
?>

the result is my site gets down whenever i try to make a new order (from backend). Do you have any idea what's wrong? Thanks in advance for any help!

本文标签: advanced custom fieldsACF in WooCommerce mail template