2017-06-15 109 views
0

我有一些自定义的变量我WooCommerce用户为:添加自定义字段变量WooCommerce电子邮件

billing_pin 
billing_piva 

等等

当一个新的客户创建它接收新帐户的电子邮件和我修改了它。

现在我的邮箱是:

<?php 
/** 
* Customer new account email 
* 
* This template can be overridden by copying it to yourtheme/woocommerce/emails/customer-new-account.php. 
* 
* HOWEVER, on occasion WooCommerce will need to update template files and you 
* (the theme developer) will need to copy the new files to your theme to 
* maintain compatibility. We try to do this as little as possible, but it does 
* happen. When this occurs the version of the template file will be bumped and 
* the readme will list any important changes. 
* 
* @see   https://docs.woocommerce.com/document/template-structure/ 
* @author  WooThemes 
* @package  WooCommerce/Templates/Emails 
* @version  1.6.4 
*/ 

if (! defined('ABSPATH')) { 
    exit; // Exit if accessed directly 
} 

?> 

<?php do_action('woocommerce_email_header', $email_heading, $email); ?> 

    <p><?php printf(__('Il tuo account di Magazzino Perfetto è stato creato con successo. Da questo momento potrai iniziare ad usare tutti i nostri servizi per aumentare la produttività della tua azienda. <b>Il tuo nome utente è la tua email</b>')); ?></p> 

<?php if ('yes' === get_option('woocommerce_registration_generate_password') && $password_generated) : ?> 

    <p><?php printf(__('La tua password è stata generata automaticamente. La trovi di seguito: %s', 'woocommerce'), '<strong>' . esc_html($user_pass) . '</strong>'); ?></p> 

<?php endif; ?> 

    <p><?php printf(__('Per accedere al riepilogo ordine, fare upgrade, modificare la password, visualizzare la licenza e scaricare le fatture, puoi cliccare sul seguente link: %s.', 'woocommerce'), make_clickable(esc_url(wc_get_page_permalink('myaccount')))); ?></p> 

    <p><?php printf(__('Per iniziare subito a lavorare puoi accedere al <b>pannello di controllo</b> online all\'indirizzo <a href="https://www.magazzinoperfetto.cloud">https://www.magazzinoperfetto.cloud</a>.')); ?></p> 

    <p><?php printf(__('Se non l\'hai già fatto, <b>scarica subito la nostra APP</b> dal Play Store <a href="#">cliccando qui</a> ed accedi inserendo i tuoi dati di accesso ed il <b>seguente PIN provvisorio:</b> ')); ?></p> 

<?php do_action('woocommerce_email_footer', $email); 

我的问题是:我该怎么插入电子邮件中的变量billing_pin?

对不起,我的英语不好......我是意大利人。

回答

0

您可以使用get_user_meta()函数来查找该值并将其回显到电子邮件模板中。

<p>Billing Pin: <?php echo get_user_meta($order->user_id, 'billing_piva', true); ?></p> 

用任何关键字实际上替换billing_piva字段。我不确定你的钥匙究竟是什么。

相关问题