简体   繁体   English

Woocommerce电子邮件模板:将产品变化权重添加到电子邮件

[英]Woocommerce email template: Add Product Variation Weight to email

I would like to add the Product weight to each variable listed in a order but I'm stumbling through the php of Woocommerce, hence my appeal here. 我想将Product权重添加到按顺序列出的每个变量中,但是我绊倒了Woocommerce的php,因此在这里很有吸引力。

I've customized WooCommerce to be a quote request system rather than an ordering system, and I want the variable unit weight (each variation of each industrial product has different weight) noted on the admin-new-order for each item so its highly visible for the individual putting together the customized quote including the customized intl shipping required for that individual order (as a lot of the industrial parts are very heavy and shipping, costly). 我已将WooCommerce定制为报价请求系统,而不是订购系统,并且我希望在admin-new-order上为每个项目注明可变的单位重量(每个工业产品的每个变体具有不同的重量),以便其高度可见对于个人,将个性化的报价汇总在一起,包括该单个订单所需的个性化的国际运输(因为许多工业零件非常重,运输成本很高)。

I have figured out that adding code to email-order-items.php is the way to go. 我已经知道将代码添加到email-order-items.php是可行的方法。 But I don't know the code to pull the weight from the standard weight input field and display it as 'X kg per unit' after the variation information. 但是我不知道从标准重量输入字段中提取重量并在变化信息后将其显示为“每单位X kg”的代码。

Notes: I have setup email templates under my child theme. 注意:我在子主题下设置了电子邮件模板。 I have weak experience with .php - hence this email to learn, but enough to add some snippets to functions.php so far 我对.php的经验很差-因此需要学习此电子邮件,但到目前为止已经足以向functions.php添加一些摘要

Cheers A 干杯

Hello you need to check in code there is many solution available for get code. 您好,您需要检入代码,有许多解决方案可用于获取代码。 if you have order it and item id then you get all the things from product object so plz try it so you get solution. 如果您有订单和商品ID,则可以从产品对象中获取所有商品,因此请尝试以获取解决方案。

can you plz show in screen short so understood more. 您能在萤幕短片中显示更多内容吗?

Thanks 谢谢

It took a while with my novice php skills, but here is the answer I have in place for the solution to my question: 我的新手php技能花了一段时间,但这是我为解决我的问题而准备的答案:

if ( $item_meta->meta ) { echo ' 如果($ item_meta-> meta){echo'
' . '。 nl2br( $_product->get_weight( 'weight') ) . nl2br($ _product-> get_weight('weight'))。 " kg per unit" .''; “公斤/单位”。 } }

This outputs the line 'x kg per unit' under the product variation output line. 这将在产品变化输出行下输出行“ x kg每单位”。

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

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