Woocommerce 电子邮件通知中的样式订单详细信息表

Style orders details table in Woocommerce email notifications(Woocommerce 电子邮件通知中的样式订单详细信息表)
本文介绍了Woocommerce 电子邮件通知中的样式订单详细信息表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在使用 WordPress 4.8.1 并使用桥接主题.
我在从新订单模板电子邮件中删除价格方面遇到了一些问题.
我想删除 price 列,但是我删除了 total 和 subtotal ,但没有得到任何东西来删除带有产品的 price 列作为通过文件.

我发现这是来自这个代码:

 $sent_to_admin,'show_image' =>错误的,'图像大小' =>数组( 32, 32 ),'纯文本' =>$plain_text,'sent_to_admin' =>$sent_to_admin,) );?>

在 email-order-details.php 模板中,我已将其从 woocommerce 模板文件夹复制到我的子主题中.

但是,如何自定义这个钩子 'wc_get_email_order_items' 或任何其他方式来删除价格?

这就是我现在所拥有的:

任何帮助将不胜感激,因为我花了很多时间寻找相同的解决方案.

解决方案

这可以做到

I am using WordPress 4.8.1 and using bridge theme.
I am facing some problem regarding removing price from new order template email.
I want to remove price column ,however I removed total and subtotal , but not getting anything to remove price column with products as going through files.

I have found this is coming from this code:

 <?php 
    echo wc_get_email_order_items( $order, array(
                'show_sku'      => $sent_to_admin,
                'show_image'    => false,
                'image_size'    => array( 32, 32 ),
                'plain_text'    => $plain_text,
                'sent_to_admin' => $sent_to_admin,
            ) ); ?>

In email-order-details.php template which I have copied to my child theme from woocommerce template folder.

But , how to customise this hook 'wc_get_email_order_items' or any other way to remove price?

This is what I have now:

Any help will be appreciated as I have spent so much hours finding solution for same.

解决方案

This can be done Overriding the following WooCommerce Templates via a Theme:

1.Template email/email-order-details.php

  • Where you will remove the block at line 38:

<th class="td" scope="col" style="text-align:<?php echo $text_align; ?>;"><?php _e( 'Price', 'woocommerce' ); ?></th>

  • And here also, all this blocks at line 50 to 63 (to remove):

<tfoot>
    <?php
        if ( $totals = $order->get_order_item_totals() ) {
            $i = 0;
            foreach ( $totals as $total ) {
                $i++;
                ?><tr>
                    <th class="td" scope="row" colspan="2" style="text-align:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo $total['label']; ?></th>
                    <td class="td" style="text-align:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo $total['value']; ?></td>
                </tr><?php
            }
        }
    ?>
</tfoot>

2.Template emails/email-order-items.php.

  • Where you will remove this block at line 59:

<td class="td" style="text-align:<?php echo $text_align; ?>; vertical-align:middle; border: 1px solid #eee; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;"><?php echo $order->get_formatted_line_subtotal( $item ); ?></td>

So you will get this:

这篇关于Woocommerce 电子邮件通知中的样式订单详细信息表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)