Search code examples
phpwordpresstemplateswoocommerceemail-notifications

How to remove the link to the order in the admin order (plain) mail in WooCommerce


I would like to remove the link in the plain text email to the admin of the shop, but keep the other information (total, paymenttype, delivery).

I found the template admin_new_order.php and the line but my research was not successful for the details.

do_action( 'woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email );

How to find the available fields for total, payment type, delivery and link? How to remove the link?


Solution

  • The code you are looking for can be found in the following template file

    emails/plain/email-customer-details.php

    • This template can be overridden by copying it to yourtheme/woocommerce/emails/plain/email-order-details.php.

    In the copy you create of the template file you can remove: line 49 - 52

    if ( $sent_to_admin ) {
        /* translators: %s: Order link. */
        echo "\n" . sprintf( esc_html__( 'View order: %s', 'woocommerce' ), esc_url( $order->get_edit_order_url() ) ) . "\n";
    }