从Woocommerce中的新订单电子邮件中删除BACS详细信息

时间:2019-03-27 04:07:36

标签: wordpress woocommerce payment

我正在将Woocommerce与Woocommerce电子邮件定制程序插件一起使用。 我为新订单创建了唯一的模板。但是此模板始终包含BACS详细信息(我的后备帐户信息,姓名,电话号码等)。 我需要从新订单电子邮件中删除该信息(系统在每次下订单时发送给客户的电子邮件)。

此插件的简短代码([woo_mb_items])获取所有数据,BACS +产品详细信息,价格,付款方式等。

我尝试使用CSS删除,但恐怕也会从结帐页面中删除它(如果客户端选择直接转移)。

---- CSS:
wc-bacs-bank-details-heading
wc-bacs-bank-details order_details bacs_details


---- email customizer email-order-items.php

<?php
/**
* Email Order Items
*
* This template can be overridden by copying it to 
yourtheme/woocommerce/emails/email-order-items.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     2.1.2
*/

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

foreach ( $items as $item_id => $item ) :
$_product     = apply_filters( 'woocommerce_order_item_product', 
$order->get_product_from_item( $item ), $item );
$item_meta    = new WC_Order_Item_Meta( $item, $_product );

if ( apply_filters( 'woocommerce_order_item_visible', true, $item ) ) 
{
    ?>
    <tr class="<?php echo esc_attr( apply_filters( 
'woocommerce_order_item_class', 'order_item', $item, $order ) ); ?>">
        <td class="td" style="text-align:left; vertical- 
align:middle;word-wrap:break-word;"><?php

            // Show title/image etc
            if ( $args['show_image'] ) {
                echo apply_filters( 
'woocommerce_order_item_thumbnail', '<div style="margin-bottom: 5px"><img 
src="' . ( $_product->get_image_id() ? current( 
wp_get_attachment_image_src( $_product->get_image_id(), 'thumbnail') ) : 
wc_placeholder_img_src() ) .'" alt="' . esc_attr__( 'Product Image', 
'woocommerce' ) . '" height="' . esc_attr( $args['image_size'][1] ) . '" 
width="' . esc_attr( $args['image_size'][0] ) . '" style="vertical- 
align:middle; margin-right: 10px;" /></div>', $item );
            }

            // Product name
            echo apply_filters( 
 'woocommerce_order_item_name', $item['name'], $item, false );

            // SKU
            if ( $args['show_sku'] && is_object( $_product 
 ) && $_product->get_sku() ) {
                echo ' (#' . $_product->get_sku() . 
 ')';
            }

            // allow other plugins to add additional 
 product information here
            do_action( 
 'woocommerce_order_item_meta_start', $item_id, $item, $order, 
 $args['plain_text'] );

            // Variation
            if ( ! empty( $item_meta->meta ) ) {
                echo '<br/><small>' . nl2br( 
 $item_meta->display( true, true, '_', "\n" ) ) . '</small>';
            }

            // File URLs
            if ( $args['show_download_links'] ) {
                $order->display_item_downloads( $item 
 );
            }

            // allow other plugins to add additional 
 product information here
            do_action( 'woocommerce_order_item_meta_end', 
 $item_id, $item, $order, $args['plain_text'] );

        ?></td>
        <td class="td" style="text-align:left; vertical- 
 align:middle;"><?php echo apply_filters( 
 'woocommerce_email_order_item_quantity', $item['qty'], $item ); ?></td>
        <td class="td" style="text-align:left; vertical- 
 align:middle;"><?php echo $order->get_formatted_line_subtotal( $item ); ? 
 ></td>
    </tr>
    <?php
}

if ( $args['show_purchase_note'] && is_object( $_product ) && ( $purchase_note = get_post_meta( $_product->id, '_purchase_note', true ) ) ) : ?>
    <tr>
        <td colspan="3" style="text-align:left; vertical-align:middle;"><?php echo wpautop( do_shortcode( wp_kses_post( $purchase_note ) ) ); ?></td>
    </tr>
<?php endif; ?>
---- Woocommerce email customizer order_items.php


<?php
/**
* Order details table shown in emails.
*
* This template can be overridden by copying it to 
yourtheme/woocommerce/emails/email-order-details.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      http://docs.woothemes.com/document/template-structure/
* @author       WooThemes
* @package  WooCommerce/Templates/Emails
* @version     2.5.0
*/

if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$obj = new stdClass();
$sent_to_admin = (isset($sent_to_admin) ? $sent_to_admin : false);
$email = (isset($email) ? $email : '');
$plain_text = (isset($plain_text) ? $plain_text : '');
$woo_mb_settings = get_option('woo_mb_settings', '');
if ($woo_mb_settings != ''){
$woo_mb_settings = json_decode($woo_mb_settings);
}
$show_payment_instruction = isset($woo_mb_settings- 
>show_payment_instruction)? $woo_mb_settings->show_payment_instruction: 1;
if($show_payment_instruction == 1 || ($show_payment_instruction == 2 && 
!$sent_to_admin)){
do_action( 'woocommerce_email_before_order_table', (isset($order) ? 
$order : $obj), $sent_to_admin, $plain_text, $email);
} ?>
<?php if ( ! $sent_to_admin ) : ?>
<h2><?php printf( __( 'Order #%s', 'woocommerce' ), $order- 
>get_order_number() ); ?></h2>
<?php else : ?>
<h2><a class="link" href="<?php echo esc_url( admin_url( 'post.php? 
post=' . (isset($order->id) ? $order->id : '') . '&action=edit' ) ); ?>"> 
<?php printf( __( 'Order #%s', 'woocommerce'), $order->get_order_number() 
); ?></a> (<?php printf( '<time datetime="%s">%s</time>', date_i18n( 'c', 
strtotime( $order->order_date ) ), date_i18n( wc_date_format(), strtotime( 
$order->order_date ) ) ); ?>)</h2>
<?php endif; ?>

<table class="email_builder_table_items" cellspacing="0" cellpadding="6" 
style="width: 100% !important;" border="1" width="100%">
<thead>
<tr>
    <th class="td" scope="col" style="text-align:left;"><?php _e( 
'Product', 'woocommerce' ); ?></th>
    <th class="td" scope="col" style="text-align:left;"><?php _e( 
'Quantity', 'woocommerce' ); ?></th>
    <th class="td" scope="col" style="text-align:left;"><?php _e( 
'Price', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<?php
// load order item table
$this->getOrdetItemTables($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
));
?>
</tbody>
<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:left; <?php if ( $i === 1 ) echo 'border-top-width: 1px'; ?>"><?php 
echo 
$total['label']; ?></th>
        <td class="td" style="text-align:left; <?php if ( $i 
=== 1 ) echo 'border-top-width: 1px;'; ?>"><?php echo $total['value']; ?> 
</td>
        </tr><?php
    }
}
?>
</tfoot>
</table>

<?php do_action( 'woocommerce_email_after_order_table', $order, 
$sent_to_admin, $plain_text, $email ); ?>

我不需要从网站上删除后备帐户信息,只需从新订单电子邮件中删除。

任何想法如何实现?谢谢。

0 个答案:

没有答案