Home>Support>Problem geeting order custom fields to the order emails

Problem geeting order custom fields to the order emails

By Eric, 8 years ago. Last reply by SiteOrigin, 8 years ago.

Hi,
I have gotten the WooCommerce Extension “Checkout Field Editor” and I like to get these fields into the order emails.
I have added into my vantage child php file below code, but something wrong.
[/code]
<?php

/**
* Enqueue the parent theme stylesheet.
*/

add_action( 'wp_enqueue_scripts', 'vantage_parent_style' );
function vantage_parent_style() {
wp_enqueue_style( 'parent-theme', get_template_directory_uri() . '/style.css' );
}

/**
* Enqueue the child theme stylesheet.
*/

add_action( 'wp_enqueue_scripts', 'vantage_child_style', 20 );
function vantage_child_style() {
wp_enqueue_style( 'child-theme', get_stylesheet_uri() );
}

/**
* Set the child theme text domain.
*/

function vantage_child_set_text_domain(){
load_theme_textdomain( 'vantage', get_stylesheet_directory() . '/languages' );
}
add_action('after_setup_theme', 'vantage_child_set_text_domain', 15);

/**
* Add the field to order emails
**/
add_filter('woocommerce_email_order_meta_keys', 'my_woocommerce_email_order_meta_keys');

function my_woocommerce_email_order_meta_keys( $keys ) {
$keys['postnummer'] = 'Postnummer';
$keys['personnummer'] = 'Personnummer';
$keys['telefon_2'] = 'Telefon 2';
$keys['postnummer_leveransadress'] = 'Postnummer leveransadress';
$keys['ort_leveransadress'] = 'Ort leveransadress';
$keys['fastighetsbeteckning'] = 'Fastighetsbeteckning';
return $keys;
}

Can you help me checking whats wrong?

Best regards
Eric

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 8 years, 8 months ago Eric

    <?php

    /**
    * Enqueue the parent theme stylesheet.
    */

    add_action( 'wp_enqueue_scripts', 'vantage_parent_style' );
    function vantage_parent_style() {
    wp_enqueue_style( 'parent-theme', get_template_directory_uri() . '/style.css' );
    }

    /**
    * Enqueue the child theme stylesheet.
    */

    add_action( 'wp_enqueue_scripts', 'vantage_child_style', 20 );
    function vantage_child_style() {
    wp_enqueue_style( 'child-theme', get_stylesheet_uri() );
    }

    /**
    * Set the child theme text domain.
    */

    function vantage_child_set_text_domain(){
    load_theme_textdomain( 'vantage', get_stylesheet_directory() . '/languages' );
    }
    add_action('after_setup_theme', 'vantage_child_set_text_domain', 15);

    /**
    * Add the field to order emails
    **/
    add_filter('woocommerce_email_order_meta_keys', 'my_woocommerce_email_order_meta_keys');

    function my_woocommerce_email_order_meta_keys( $keys ) {
    $keys['postnummer'] = 'Postnummer';
    $keys['personnummer'] = 'Personnummer';
    $keys['telefon_2'] = 'Telefon 2';
    $keys['postnummer_leveransadress'] = 'Postnummer leveransadress';
    $keys['ort_leveransadress'] = 'Ort leveransadress';
    $keys['fastighetsbeteckning'] = 'Fastighetsbeteckning';
    return $keys;
    }

  2. 8 years, 8 months ago SiteOrigin
    Hi, I Work Here

    Hi Eric

    Thanks for your email. I’ll respond there shorlty.

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More