Home Forums Front-end Issues ACF in Woocommerce Email Reply To: ACF in Woocommerce Email

  • I created a new field – order number
    Condition: record type – equal – order
    And pasted the following code into the file functions.php

    //Order number
    add_action( 'woocommerce_email_before_order_table', 'alx_add_content_specific_email', 20, 4 );
    function alx_add_content_specific_email( $order, $sent_to_admin, $plain_text, $email ) {
       if ( $email->id == 'customer_completed_order' ) 
            if (get_field('alx_sdek', $order->id)) {
          echo '<h2 class="email-upsell-title">Информация об отправлении:</h2><p class="email-upsell-p">Номер отправления: <strong>';
              the_field('alx_sdek', $order->id);
              echo '</strong> отследить можно на сайте <a href="">СДЭК</a>.</p>';