Created
September 18, 2023 10:27
-
-
Save damiencarbery/20d7d7aebb04101e6bb01d45b50b6687 to your computer and use it in GitHub Desktop.
WooCommerce - remove email order details table - Remove the order details table (listing items ordered) from order emails. Optionally remove billing and shipping details.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: WooCommerce - remove email order details table. | |
Plugin URI: https://www.damiencarbery.com/2023/09/remove-order-details-from-woocommerce-emails/ | |
Description: Remove the order details table (listing items ordered) from order emails. Optionally remove billing and shipping details. | |
Author: Damien Carbery | |
Author URI: https://www.damiencarbery.com | |
Version: 0.1.20230918 | |
*/ | |
defined( 'ABSPATH' ) || exit; | |
add_action( 'woocommerce_email_order_details', 'dcwd_email_order_details_table', 5, 4 ); | |
function dcwd_email_order_details_table( $order, $sent_to_admin, $plain_text, $email ) { | |
/* | |
// Can limit this code to specific emails. | |
if ( 'customer_completed_order' != $email->id ) { | |
return; | |
} | |
*/ | |
// Remove the order details table (with items ordered, quantity and prices). | |
remove_action( 'woocommerce_email_order_details', array( WC()->mailer(), 'order_details' ), 10, 4 ); | |
// Remove customer addresses (billing and shipping). | |
//remove_action( 'woocommerce_email_customer_details', array( WC()->mailer(), 'email_addresses' ), 20, 3 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment