• Resolved adsim

    (@adsim)


    Hi,

    I try to remove unnecessary payment informations from specific customer emails.
    I found some snippets, but I seem to miss something.
    My code so far:

    add_action( 'woocommerce_email_before_order_table', 'raps_remove_content_specific_email', 20, 4 );
      
    function raps_remove_content_specific_email( $order, $sent_to_admin, $plain_text, $email ) {
        if ( $email->id == 'customer_note' ) {
    		if ( ! class_exists( 'WC_Payment_Gateways' ) ) {
    			return;
    		}
    		 
    		$gateways = WC_Payment_Gateways::instance(); 
    		$available_gateways = $gateways->get_available_payment_gateways();
    	 
    		if ( isset( $available_gateways['bacs'] ) ){
    			remove_action( 'woocommerce_email_before_order_table', array( $available_gateways['bacs'], 'email_instructions' ), 10, 3 );
    		}  
    	}
    }

    If I remove the if ( $email->id == ‘customer_note’ ) {} it works – but for all emails -, but I can’t get it work only for specific emails.

    Can anybody tell what’s wrong with my code?
    Thanks.

    • This topic was modified 3 years, 11 months ago by adsim.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove payment information from specific emails’ is closed to new replies.