This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

Problem geeting order custom fields to the order emails

Resolved 2 replies technicalthemetheme-vantage
10 years ago · Last reply by Support Assistants 10 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.

Need fast email support? Get SiteOrigin Premium

Replies

2
  1. Eric 10 years, 1 month ago

    <?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. Support Assistants 10 years, 28 days ago

    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.

Have a different question or issue?

Start New Thread