2017-11-16 6 views
1

私は現在、文字通り4日間、顧客と管理者に送信されている電子メールから価格を削除する方法を探しています。私は小計セクションと合計セクションを削除することができましたが、商品ごとの価格の見出しは削除できましたが、テーブル内の物理的な価格セルは削除できません。Woocommerceからの価格の削除電子メール

以下は、私が調整したコードと、電子メールの外観のスクリーンショットです。

email_order_details.php

<?php 
 
if (! defined('ABSPATH')) { 
 
\t exit; 
 
} 
 

 
$text_align = is_rtl() ? 'right' : 'left'; 
 

 
do_action('woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text, $email); ?> 
 

 
<?php if (! $sent_to_admin) : ?> 
 
\t <h2><?php printf(__('Order #%s', 'woocommerce'), $order->get_order_number()); ?> (<?php printf('<time datetime="%s">%s</time>', $order->get_date_created()->format('c'), wc_format_datetime($order->get_date_created())); ?>)</h2> 
 
<?php else : ?> 
 
\t <h2><a class="link" href="<?php echo esc_url(admin_url('post.php?post=' . $order->get_id() . '&action=edit')); ?>"><?php printf(__('Order #%s', 'woocommerce'), $order->get_order_number()); ?></a> (<?php printf('<time datetime="%s">%s</time>', $order->get_date_created()->format('c'), wc_format_datetime($order->get_date_created())); ?>)</h2> 
 
<?php endif; ?> 
 

 
<div style="margin-bottom: 40px;"> 
 
\t <table class="td" cellspacing="0" cellpadding="6" style="width: 100%; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;" border="1"> 
 
\t \t <thead> 
 
\t \t \t <tr> 
 
\t \t \t \t <th class="td" scope="col" style="text-align:<?php echo $text_align; ?>;"><?php _e('Product', 'woocommerce'); ?></th> 
 
\t \t \t \t <th class="td" scope="col" style="text-align:<?php echo $text_align; ?>;"><?php _e('Quantity', 'woocommerce'); ?></th> 
 
\t \t \t </tr> 
 
\t \t </thead> 
 
\t \t <tbody> 
 
\t \t \t <?php echo wc_get_email_order_items($order, array(
 
\t \t \t \t 'show_sku'  => $sent_to_admin, 
 
\t \t \t \t 'show_image' => false, 
 
\t \t \t \t 'image_size' => array(32, 32), 
 
\t \t \t \t 'plain_text' => $plain_text, 
 
\t \t \t \t 'sent_to_admin' => $sent_to_admin, 
 
\t \t \t)); ?> 
 
\t \t </tbody> 
 
\t \t <tfoot> 
 
\t \t \t <?php 
 
\t \t \t \t if ($order->get_customer_note()) { 
 
\t \t \t \t \t ?><tr> 
 
\t \t \t \t \t \t <th class="td" scope="row" colspan="2" style="text-align:<?php echo $text_align; ?>;"><?php _e('Note:', 'woocommerce'); ?></th> 
 
\t \t \t \t \t \t <td class="td" style="text-align:<?php echo $text_align; ?>;"><?php echo wptexturize($order->get_customer_note()); ?></td> 
 
\t \t \t \t \t </tr><?php 
 
\t \t \t \t } 
 
\t \t \t ?> 
 
\t \t </tfoot> 
 
\t </table> 
 
</div> 
 

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

<?php 
 
if (! defined('ABSPATH')) { 
 
\t exit; 
 
} 
 

 
$text_align = is_rtl() ? 'right' : 'left'; 
 

 
foreach ($items as $item_id => $item) : 
 
\t $product = $item->get_product(); 
 
\t if (apply_filters('woocommerce_order_item_visible', true, $item)) { 
 
\t \t ?> 
 
\t \t <tr class="<?php echo esc_attr(apply_filters('woocommerce_order_item_class', 'order_item', $item, $order)); ?>"> 
 
\t \t \t <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; word-wrap:break-word;"><?php 
 

 
\t \t \t \t // Show title/image etc 
 
\t \t \t \t if ($show_image) { 
 
\t \t \t \t \t 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($image_size[1]) . '" width="' . esc_attr($image_size[0]) . '" style="vertical-align:middle; margin-' . (is_rtl() ? 'left' : 'right') . ': 10px;" /></div>', $item); 
 
\t \t \t \t } 
 

 
\t \t \t \t // Product name 
 
\t \t \t \t echo apply_filters('woocommerce_order_item_name', $item->get_name(), $item, false); 
 

 
\t \t \t \t // SKU 
 
\t \t \t \t if ($show_sku && is_object($product) && $product->get_sku()) { 
 
\t \t \t \t \t echo ' (#' . $product->get_sku() . ')'; 
 
\t \t \t \t } 
 

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

 
\t \t \t \t wc_display_item_meta($item); 
 

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

 
\t \t \t ?></td> 
 
\t \t \t <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 apply_filters('woocommerce_email_order_item_quantity', $item->get_quantity(), $item); ?></td> 
 
\t \t </tr> 
 
\t \t <?php 
 
\t } 
 

 
\t if ($show_purchase_note && is_object($product) && ($purchase_note = $product->get_purchase_note())) : ?> 
 
\t \t <tr> 
 
\t \t \t <td colspan="3" 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 wpautop(do_shortcode(wp_kses_post($purchase_note))); ?></td> 
 
\t \t </tr> 
 
\t <?php endif; ?> 
 

 
<?php endforeach; ?>

email_order_items.php

スクリーンショット

screenshot

ありがとうございます。

+0

手紙から価格を削除するには、チェックアウトページから削除する必要があります。 "ありがとう"ページ –

+1

私はこれを行いました。私が抱えている唯一の問題は、依然として$ 0.00です。私は複数の異なることを試みましたが、どれも働いていませんでした。 – joshualavers

+0

あなたのテーマでテンプレートを正しく上書きしましたか? https://docs.woocommerce.com/document/template-structure/ この解決策はうまくいくはずですが、正しく実行されたようですが、https://stackoverflow.com/questions/46150455/customize-orders-details-テーブル・イン・ウーココマースの電子メール通知 – Matts

答えて

0

このテンプレート\order\order-details-item.phpを変更して商品価格を削除してください。

価格が表示されないようにするには、次のコードをコメントアウトしてください。

<td class="woocommerce-table__product-total product-total"> 
    <?php echo $order->get_formatted_line_subtotal($item); ?> 
</td> 
関連する問題