• Resolved Patabugen

    (@patabugen)


    I’m using this plugin to collect sensitive information which I’d like to be emailed to the admin, but not emailed to the customer.

    I’ve spent the afternoon trying to filter them out using filters like woocommerce_email_order_meta_keys – but those filters seem to apply to both emails (to admin and customers) and I’ve not figured a way to differenciate.

    Any suggestions/tips on how to remove some (but not all) of the custom item meta from the email?

    In other emails I’ve seen the suggestion of using CSS to hide fields from emails, I need to actually remove it – not just hide it.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,
    You can use this filter to remove the fields,
    apply_filters( 'woocommerce_email_order_meta_fields', array(), $sent_to_admin, $order );

    Please try below code,

    add_filter('woocommerce_email_order_meta_fields','edit_custom_email_meta_fields',10 , 3);
    
    function edit_custom_email_meta_fields($fields, $sent_to_admin, $order) {
        if(!$sent_to_admin){
           // Filter values and return
        }
        return $fields;
    }

    Note: It is not tested. Hope It work’s

    Thread Starter Patabugen

    (@patabugen)

    Hey Rahul,

    Thanks for the suggestion! I’m afraid that filter doesn’t work, it doesn’t actually seem to ever get used in fact – nothing else hooks to it so the only input (from either that or the depreciated version) is an empty array.


    Sami

    Hi,

    If it is not working you can go with the filter `woocommerce_email_order_meta_keys’. that is the only solution.

    add_filter('woocommerce_email_order_meta_fields','edit_custom_email_meta_fields',10 , 2);

    Here in the function second parameter is a boolean value, that indicates is mail send to admin or not.

    Please try again with the same.

    Thank You!

    Hi,

    It’s been a week, we didn’t got any replies.
    We hope issue is fixed.
    Please feel free to contact us, If you have further queries.

    Thank You!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove Custom Product Addon Fields from Customer (but not admin) email’ is closed to new replies.