• Resolved marktrader

    (@marktrader)


    Hello

    I would like to remove the order number from all customer emails. We have multiple systems connected to our Woocommerce site and another service is generating order ID’s that the customer will use for order tracking.

    I’ve managed to remove all the others, just left with the one that appears in the email next to the date.
    Can anyone guide me on how to do this?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Shameem a11n

    (@shameemreza)

    Hi @marktrader

    You can remove the order number from customer emails by editing the email templates. The template to copy and override is woocommerce/templates/emails/email-order-details.php

    Please note that writing or providing custom code is not within the scope of our support policy. If you are still having problems, we recommend asking development questions on the #developers channel of the WooCommerce Community Slack. Many of our developers hang out there and will be able to offer insights into your question. You can also seek help from the following:

    I wish I could help more, but hopefully, this gets you going in the right direction to get the job done.

    Thread Starter marktrader

    (@marktrader)

    Hi @shameemreza, thanks for the links. I managed to sort it out.


    I overrode & edited the template, basically displaying only what I want in the email template.
    Here’s an example of the template. Maybe it can help someone in need:


    <?php
    // Check if the order object is available
    if ( ! defined( 'ABSPATH' ) ) {
    exit;
    }

    do_action( 'woocommerce_email_header', $email_heading, $email );

    // Get order items
    $items = $order->get_items();
    ?>

    <div style="margin: 0 auto; padding: 0; width: 100%; max-width: 600px;">

    <p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $order->get_billing_first_name() ) ); ?></p>
    <p><?php printf( esc_html__( 'We have received your order and it is now being processed. One of our consultants will be in touch with you shortly.', 'woocommerce' ) ); ?></p>

    <!-- Start creating the custom order details table -->
    <h2 style="margin: 0 0 16px; padding: 0;"><?php echo __( 'Order Details', 'woocommerce' ); ?></h2>

    <table cellspacing="0" cellpadding="6" style="border: 1px solid #eee; width: 100%; max-width: 100%; margin: 0 auto; border-collapse: collapse;">
    <thead>
    <tr>
    <th style="text-align:left; border: 1px solid #eee; padding: 12px;"><?php echo __( 'Product', 'woocommerce' ); ?></th>
    <th style="text-align:left; border: 1px solid #eee; padding: 12px;"><?php echo __( 'Quantity', 'woocommerce' ); ?></th>
    <th style="text-align:left; border: 1px solid #eee; padding: 12px;"><?php echo __( 'Price', 'woocommerce' ); ?></th>
    </tr>
    </thead>
    <tbody>
    <?php
    // Loop through the order items
    foreach ( $items as $item_id => $item ) {
    $product = $item->get_product();
    $product_name = $product ? $product->get_name() : $item->get_name();
    $quantity = $item->get_quantity();
    $price = $item->get_total();
    ?>
    <tr>
    <td style="text-align:left; border: 1px solid #eee; padding: 12px;"><?php echo esc_html( $product_name ); ?></td>
    <td style="text-align:left; border: 1px solid #eee; padding: 12px;"><?php echo esc_html( $quantity ); ?></td>
    <td style="text-align:left; border: 1px solid #eee; padding: 12px;"><?php echo wc_price( $price ); ?></td>
    </tr>
    <?php
    }
    ?>
    </tbody>
    </table>

    </div>

    <?php
    // Footer
    do_action( 'woocommerce_email_footer', $email );
    ?>

    Here’s the output

    Plugin Support Shameem a11n

    (@shameemreza)

    Hi @marktrader

    I’m glad you were able to find a solution to your inquiry here and thanks for sharing it with the community too! 🙂

    Should you have further inquiries, kindly create a new topic here.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.