Remove order information section from email template in woocommerce

I am trying to delete the section Order Information in letters with completed orders and customer invoices.

enter image description here

Cannot find how to remove this in:

wp-content/plugins/woocommerce/templates/emails/customer-completed-order.php

<?php
/**
 * Subscription information template
 *
 * @author  Brent Shepherd / Chuck Mac
 * @package WooCommerce_Subscriptions/Templates/Emails
 * @version 1.5
 */
if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly
}
?>
<?php if ( ! empty( $subscriptions ) ) : ?>
<h2><?php esc_html_e( 'Order Information:', 'woocommerce-subscriptions' ) ?></h2>
<table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
    <thead>
        <tr>
            <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php esc_html_e( 'Order', 'woocommerce-subscriptions' ); ?></th>
            <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php esc_html_e( 'Start Date', 'woocommerce-subscriptions' ); ?></th>
            <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php esc_html_e( 'End Date', 'woocommerce-subscriptions' ); ?></th>
            <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php esc_html_e( 'Price', 'woocommerce-subscriptions' ); ?></th>
        </tr>
    </thead>
    <tbody>
    <?php foreach ( $subscriptions as $subscription ) : ?>
        <tr>
            <td scope="row" style="text-align:left; border: 1px solid #eee;"><a href="<?php echo esc_url( ( $is_admin_email ) ? wcs_get_edit_post_link( $subscription->id ) : $subscription->get_view_order_url() ); ?>"><?php echo esc_html( $subscription->get_order_number() ); ?></a></td>
            <td scope="row" style="text-align:left; border: 1px solid #eee;"><?php echo esc_html( date_i18n( wc_date_format(), $subscription->get_time( 'start', 'site' ) ) ); ?></td>
            <td scope="row" style="text-align:left; border: 1px solid #eee;"><?php echo esc_html( ( 0 < $subscription->get_time( 'end' ) ) ? date_i18n( wc_date_format(), $subscription->get_time( 'end', 'site' ) ) : __( 'When Cancelled', 'woocommerce-subscriptions' ) ); ?></td>
            <td scope="row" style="text-align:left; border: 1px solid #eee;"><?php echo wp_kses_post( $subscription->get_formatted_order_total() ); ?></td>
        </tr>
    <?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>

Please inform.

0
source share
4 answers

You do not want to remove the entire action hook. This can affect other plugins that rely on its presence. (Not to mention that order details are in the file woocommerce_email_order_details, not the hook woocommerce_email_order_meta).

- , WC_Emails::order_details(), woocommerce_email_order_details

remove_action() add_action() , . , . , remove_action() , add_action(), .

function so_39251827_remove_order_details( $order, $sent_to_admin, $plain_text, $email ){
    $mailer = WC()->mailer(); // get the instance of the WC_Emails class
    remove_action( 'woocommerce_email_order_details', array( $mailer, 'order_details' ), 10, 4 );
}
add_action( 'woocommerce_email_order_details', 'so_39251827_remove_order_details', 5, 4 );

EDIT:

  • emails/customer-completed-order.php . , .
  • functions.php , .

# 2:

:

function so_39251827_remove_subscription_details( $order, $sent_to_admin, $plain_text, $email ){
    remove_action( 'woocommerce_email_after_order_table', array( 'WC_Subscriptions_Order', 'add_sub_info_email' ), 15, 3 );
}
add_action( 'woocommerce_email_after_order_table', 'so_39251827_remove_subscription_details', 5, 4 );
+1

 do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text );

-1

do_action ('woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text);

.

-1

Ze swojej strony, jako użytkownika chcę polecić stronkę: https://www.templatemonster.com/pl/kategoria/bestsellery-woocommerce/ Szablony na jakikolwiek temat, darmowe lub płatne woocommerce

-2

Source: https://habr.com/ru/post/1656065/


All Articles