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.
我想将产品重量添加到订单中列出的每个变量,但我在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. 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.
我已经发现将代码添加到email-order-items.php是可行的方法。但我不知道从标准重量输入字段中提取重量的代码,并在变化信息后将其显示为“每单位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
2 个解决方案
#1
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
#2
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 '
' . nl2br( $_product->get_weight( 'weight') ) . " kg per unit" .''; }
if($ item_meta-> meta){echo''。 nl2br($ _product-> get_weight('weight'))。 “每单位千克”。''; }
This outputs the line 'x kg per unit' under the product variation output line.
这将在产品变化输出线下输出'x kg / unit'。
#1
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
#2
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 '
' . nl2br( $_product->get_weight( 'weight') ) . " kg per unit" .''; }
if($ item_meta-> meta){echo''。 nl2br($ _product-> get_weight('weight'))。 “每单位千克”。''; }
This outputs the line 'x kg per unit' under the product variation output line.
这将在产品变化输出线下输出'x kg / unit'。