Black Friday & Cyber Monday SUPER SALE ALL WEEK:
Grab 40% OFF on plugins
Days
Hours
Minutes
Seconds

How to Remove the Shipping Row from the Order Table in WooCommerce Email Notifications?

To make emails less cluttered and to improve the visual appearance of emails, the provided code is a modification to the WooCommerce email template to remove the shipping row from the order table in email notifications.

Firstly, locate the template file (emails/email-order-details.php) within your site’s designated folder: wp-content\plugins\woocommerce\templates\emails. This is the path to the WooCommerce email templates. Replace a few lines of code to the file ’email-order-details.php’ template. The relevant code starts at line 61. Simply replace the existing code between the opening <tfoot>tag and the closing </tfoot>tag with the provided code snippet.

 <tfoot>
            <?php
                if ( $totals = $order->get_order_item_totals() ) {
                    $i = 0;
                    foreach ( $totals as $key_total => $total ) {
                        $i++;
                        if( $key_total != 'shipping' ):
                        ?><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
                        endif;
                    }
                }
                if ( $order->get_customer_note() ) {
                    ?><tr>
                        <th class="td" scope="row" colspan="2" style="text-align:<?php echo $text_align; ?>;"><?php _e( 'Note:', 'woocommerce' ); ?></th>
                        <td class="td" style="text-align:<?php echo $text_align; ?>;"><?php echo wptexturize( $order->get_customer_note() ); ?></td>
                    </tr><?php
                }
            ?>
        </tfoot>

Output

The below output shows that the shipping row is removed from the email order details table.

How to Remove the Shipping Row from the Order Table in WooCommerce Email Notifications

The below image shows that the default email notification has the shipping method included in the email order details table as shown below.

How to Remove the Shipping Row from the Order Table in WooCommerce Email Notifications

Alternatively, you can also send a message for on hold status email for a specific shipping method in WooCommerce.

Browse more in: Code Snippets, WooCommerce How Tos, WooCommerce Tutorials

Share It:

Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x