Created
November 13, 2023 13:22
-
-
Save AnanthFlycart/56a0a2cc397fc5a6ae3f5fc087456fa4 to your computer and use it in GitHub Desktop.
CUW: Remove item meta on emails
This file contains hidden or 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
| add_filter('woocommerce_order_item_get_formatted_meta_data', function($meta_data, $item) { | |
| if (did_action('woocommerce_email_header')) { | |
| if (did_action('woocommerce_email_header') != did_action('woocommerce_email_footer')) { | |
| foreach ($meta_data as $key => $data) { | |
| if (isset($data->key) && in_array($data->key, ['cuw_offer_text', 'cuw_discount_text'])) { | |
| unset($meta_data[$key]); | |
| } | |
| } | |
| } | |
| } | |
| return $meta_data; | |
| }, 1000, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment