简体   繁体   English

Woocommerce 电子邮件变量不起作用

[英]Woocommerce email variables not working

I am using Woocommerce emails variables as refered here: https://docs.woocommerce.com/document/automated-follow-up-emails-docs/email-variables-and-merge-tags/我正在使用这里提到的 Woocommerce 电子邮件变量: https ://docs.woocommerce.com/document/automated-follow-up-emails-docs/email-variables-and-merge-tags/

I've added the variable {customer_name} to my e-mail template title, but it doesn't get processed and still shows the same slug in the email I get.我已经将变量 {customer_name} 添加到我的电子邮件模板标题中,但它没有得到处理并且仍然在我收到的电子邮件中显示相同的 slug。

Using the variable:使用变量:

在此处输入图片说明

Result in e-mail:结果在电子邮件中: 在此处输入图片说明

What do I need to improve?我需要改进什么? Best wishes最好的祝愿

Make sure your WooCommerce and all related Woo plugins are up-to-date.确保您的 WooCommerce 和所有相关的 Woo 插件都是最新的。

I had this issue but with {order_number} for the default Customer Renewal Invoice email.我遇到了这个问题,但默认客户续订发票电子邮件为 {order_number}。 The Subject and Email Heading would just print {order_number} and not parse it into the actual number like 3890423.主题和电子邮件标题只会打印 {order_number} 而不会将其解析为实际数字,如 3890423。

My issue ended up being that the WooCommerce Subscription plugin needed to be updated.我的问题最终是需要更新 WooCommerce 订阅插件。 I did not realize this until I went to make a ticket and they ask for the System Report.直到我去办票并且他们要求系统报告时,我才意识到这一点。 In my report it was showing my Subscription and ShippingEasy plugin needed updates.在我的报告中,它显示了我的 Subscription 和 ShippingEasy 插件需要更新。 This DID NOT show up in the normal wordpress plugin dashboard.这没有出现在普通的 wordpress 插件仪表板中。 As far as I knew all of my plugins were updated.据我所知,我的所有插件都已更新。 Apparently I missed it when the WooCommerce Helper plugin stopped working.显然,当 WooCommerce Helper 插件停止工作时,我错过了它。 Now you have to connect your wordpress site to your WooCommerce account by going to your wordpress dashboard and clicking "WooCommerce" -> "Extentions", then the "WooCommerce.com Subscriptions" tab.现在,您必须通过转到您的 wordpress 仪表板并单击“WooCommerce”->“扩展”,然后单击“WooCommerce.com 订阅”选项卡,将您的 wordpress 站点连接到您的 WooCommerce 帐户。 Once you connect everything you can finally get the updates you need.连接所有内容后,您最终可以获得所需的更新。 VERY annoying.很烦人。 Updates should just be-able to work via the normal plugin dashboard like every other plugin.更新应该能够像其他插件一样通过普通插件仪表板工作。

I have also read other places that you might need the WooCommerce Follow-Ups plugin to use all of those variable.我还阅读了其他地方,您可能需要 WooCommerce Follow-Ups 插件来使用所有这些变量。 In fact, what you linked to was documentation for that plugin.事实上,您链接到的是该插件的文档。

I found my same issue on a couple other threads but they were 'closed' to responses.我在其他几个线程上发现了同样的问题,但它们对响应“关闭”。 Hopefully this simple but annoying solution will help someone else.希望这个简单但烦人的解决方案能帮助其他人。

The first option is to check if you have installed any plugin for sending an email.第一个选项是检查您是否安装了任何用于发送电子邮件的插件。 It might be a conflict with your default one.它可能与您的默认设置冲突。 Just try to disable other plugins except for WooCommerce and try again.只需尝试禁用除 WooCommerce 之外的其他插件,然后重试。

The second option is you can use "woocommerce_email_before_order_table" hook to set your own email thereby customize the code.第二个选项是您可以使用“woocommerce_email_before_order_table”挂钩来设置您自己的电子邮件,从而自定义代码。 see below:见下文:

add_action( 'woocommerce_email_before_order_table', 'add_order_email_instructions', 10, 2 );

function add_order_email_instructions( $order, $sent_to_admin ) {

  if ( ! $sent_to_admin ) {

    if ( 'cod' == $order->payment_method ) {
      // cash on delivery method
      echo '<p><strong>Instructions:</strong> Full payment is due immediately upon delivery: <em>cash only, no exceptions</em>.</p>';
    } else {
      // other methods (ie credit card)
      echo '<p><strong>Instructions:</strong> Please look for "Madrigal Electromotive GmbH" on your next credit card statement.</p>';
    }
  }
}

You can check this link also.您也可以查看此链接 I this guide might be helpful for you.我本指南可能对您有所帮助。

Thanks.谢谢。

In my case, the plugin WooCommerce Multilingual (WPML) was the issue.就我而言,插件 WooCommerce Multilingual (WPML) 是问题所在。 I temporarily deactivated it to further investigate the issue.我暂时停用了它以进一步调查该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM