Printing order mail has repeated lines on every page

@webmoments, ChatGPT give you a path to try, let me know how it goes:

To address this issue, you may need to customize the WooCommerce email template. Please note that modifying code requires some technical expertise, and it’s always a good idea to backup your website before making any changes. Here are the general steps you can take:

  1. Identify the Email Template: Find the email template responsible for the order email. WooCommerce uses templates to generate emails, and you can customize them based on your needs.
  2. Access the WooCommerce Email Templates: Navigate to your WordPress theme directory, and look for a folder named woocommerce. Inside this folder, there should be another folder named emails. This is where the email templates are stored.
  3. Locate the Order Email Template: Look for the template file related to the order email. It is likely named something like customer-processing-order.php or customer-completed-order.php.
  4. Edit the Template: Open the identified template file in a code editor. Look for the section that outputs the shipping, payment, and order total lines. You may need to find the loop that goes through each item and modify it to display these lines only once.For example, you might need to move the lines outside the loop or add a conditional statement to display them only once. Here’s a simplified example:
foreach ( $order->get_items() as $item_id => $item ) {
    // Output individual item details here.
}

// Move or add lines to display shipping, payment, and order total once.
echo '<tr><td colspan="2">Shipping:</td><td>' . $order->get_shipping_method() . '</td></tr>';
echo '<tr><td colspan="2">Payment Method:</td><td>' . $order->get_payment_method() . '</td></tr>';
// ... other lines ...

  1. Testing: After making changes, save the file and test by placing an order with multiple items to see if the issue is resolved. Ensure that the lines for shipping, payment, and order total only appear once.

Remember to consider updating these changes when your WooCommerce plugin or theme receives updates, as they might overwrite your customizations. It’s advisable to use a child theme or a custom plugin for such modifications to ensure they persist through updates.

  • This reply was modified 20 hours, 10 minutes ago by Rok Meglič.

Hello @webmoments,

Are you able to share a screenshot of the order total lines? You can use a screenshot sharing software like https://snipboard.io/.

Looking forward to assisting you further.

Thread Starter
sl

(@webmoments)

I actually tackled this problem by adding a tiny css style in the email-order-details.php file:

<tfoot style=”display: table-row-group”>

Hey, @webmoments!

I actually tackled this problem by adding a tiny css style in the email-order-details.php file:<tfoot style=”display: table-row-group”>

That’s great! We are glad you were able to solve the issue.

Thank you for sharing the solution here, and contributing to the WooCommerce Community. This might help other users in the future 😃

I’ll mark this as solved, okay? Please feel free to reach out if you need help with anything else.

Have a wonderful day!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer