Created
June 23, 2020 12:18
-
-
Save iamsathyaseelan/4aa4793ed139de33a25cec98389e2e09 to your computer and use it in GitHub Desktop.
view order meta shortcodes Email customizer plus
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
<?php | |
add_filter('woocommerce_email_customizer_plus_additional_short_codes_list',function($additional_short_codes){ | |
$order_id = 803; | |
$order_meta_keys = get_post_custom_keys($order_id); | |
if (!empty($order_meta_keys)) { | |
$order_meta_values = get_post_meta($order_id); | |
foreach ($order_meta_keys as $order_meta_key) { | |
if (isset($order_meta_values[$order_meta_key]) && isset($order_meta_values[$order_meta_key][0])) { | |
$order_meta_key_for_short_code = str_replace(' ', '_', $order_meta_key); | |
$key = 'order_meta.'.$order_meta_key_for_short_code; | |
if (is_string($order_meta_values[$order_meta_key][0])) { | |
$additional_short_codes[$key] = $order_meta_values[$order_meta_key][0]; | |
} | |
} | |
} | |
} | |
return $additional_short_codes; | |
},10,3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment