Support

Account

Home Forums Front-end Issues ACF in Woocommerce Email

Solving

ACF in Woocommerce Email

  • Hi All,

    Just wondering if anyone has some insight into how to display an ACF in the woocommerce email confirmation.

    I have tried several things but nothing seems to work.

    Any help would be hugely appreciated.

    • alex13

    • December 3, 2019 at 5:57 am

    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="https://www.cdek.ru/track.html">СДЭК</a>.</p>';
       }
    }
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.