Support » Plugin: WooCommerce Hear About Us » Remove source from customer email

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author siteoptimo

    (@siteoptimo)

    Hi Pandaj,

    You can use the default WooCommerce ‘woocommerce_email_order_meta_keys’ filter to filter this field from the customer emails.

    Regards,

    Pieter

    Hello,

    I’m sorry but would it be possible for you to let me know exactly what to put in functions.php? I’m really not sure where to begin.

    Thank you very much.

    Okay this was a complete guess, but I think works!

    Does it look right?

    add_filter( 'woocommerce_email_order_meta_keys' , 'remove_hearaboutus_fields' );
    
    function remove_hearaboutus_fields( $fields ) {
         unset($fields['wchau_source']);
    
         return $fields;
    }

    @siteiptimo I take that back, it doesn’t work!

    Plugin Author siteoptimo

    (@siteoptimo)

    Hi Pandaj,

    Your code should work, but you’re probably removing the fields before we’re inserting it.

    Have you tried giving it a later priority (ie 15)?

    add_filter( 'woocommerce_email_order_meta_keys' , 'remove_hearaboutus_fields',15 );
    
    function remove_hearaboutus_fields( $fields ) {
         unset($fields['wchau_source']);
    
         return $fields;
    }

    Hi,

    I tried adding a note in a Woocommerce order to send another email out and the source is still included with your code above.

    Hi,

    Your plugin is great, and does exactly what I need, but I need to remove the output on the customer email.

    I’ve tried both the above codes in my childtheme functions.php file which didn’t work.

    I was wondering if there’s a way to do it by editing the cutomer-processing-order.php

    Thanks in advance.

    Sarah

    Plugin Author siteoptimo

    (@siteoptimo)

    Hey Sarah,

    We made some changes and the above code no longer works. Now you will need to do this:

    add_filter( 'woocommerce_email_order_meta_keys' , 'remove_hearaboutus_fields',15 );
    
    function remove_hearaboutus_fields( $fields ) {
         unset($fields[__( 'Source', 'woocommerce-hear-about-us' )]);
    
         return $fields;
    }

    If that doesn’t work, please try and remove that filter all together:

    function remove_wchau_email_field() {
        global $WCHAU;
        remove_filter( 'woocommerce_email_order_meta_keys', array( $WCHAU->customField, 'add_field_to_email' ) );
    }
    
    add_action('init', 'remove_wchau_email_field', 15);

    Hope this solves your problem.

    Koen

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Remove source from customer email’ is closed to new replies.