I'm trying to delete the Order Information section on a Completed Order and Customer Invoice emails.
Can't find how to delete this in the:
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 advise.
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text );
try to remove this hook.
You don't want to remove the entire action hook. This could effect other plugins that rely on it's presence. (Not to mention the order details are on the
woocommerce_email_order_details
details hook and not thewoocommerce_email_order_meta
hook anyway).The proper way to remove the order details from all emails is to remove their callback function which is
WC_Emails::order_details()
which is added to thewoocommerce_email_order_details
hook hereYou cannot call
remove_action()
directly and so must call it from inside anadd_action()
callback... after it has been added to it's hook, but before it has been run. In this case we're just going to sneak onto the same hook, but with an earlier priority. Also note, thatremove_action()
must have the same priority as theadd_action()
that you are trying to remove.EDIT: Instructions for use
emails/customer-completed-order.php
template and remove it from your theme. You do not need to edit it directly to solve this question.functions.php
or preferably a custom-snippets plugin, such as this one.EDIT #2: Remove Subscriptions Info Only
Replace the above code with the following:
Removing this part should fix the job
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text );