Support

Account

Home Forums General Issues WooCommerce ACF field in email template Reply To: WooCommerce ACF field in email template

  • To display your custom field in the email template next to the quantity, you can modify the code to hook into the appropriate filter for the email template. Here’s an adjusted version of your code:
    `function email_custom_field($item_quantity, $cart_item, $cart_item_key, $order){
    $price = get_field(‘price_for’, $cart_item[‘product_id’]);
    return ($price) ?
    $item_quantity . ‘ / ‘ . $price
    :
    $item_quantity;
    }
    add_filter(‘woocommerce_order_item_quantity_html’, ’email_custom_field’, 999, 4);

    This code will display your custom field next to the quantity in DGCustomerFirst the email template. Ensure to place this code in your theme’s functions.php file or in a custom plugin.