Skip to content

Instantly share code, notes, and snippets.

@PechenkiUA
Created August 31, 2021 09:45
Show Gist options
  • Save PechenkiUA/144b012279d08405e3c0df529b86302f to your computer and use it in GitHub Desktop.
Save PechenkiUA/144b012279d08405e3c0df529b86302f to your computer and use it in GitHub Desktop.
wc telsender all meta
<?php
/* Telsender all meta*/
function meta_wc_function($list, $order_id)
{
$order = wc_get_order($order_id);
$allmeta = $order->get_meta_data();
$mmeta = '';
foreach ($allmeta as $key => $meta) {
$d = $meta->get_data();
$mmeta .= sprintf('{%s} : %s', $d['key'], $d['value']);
$mmeta .= PHP_EOL;
}
$list['{all-meta}'] = $mmeta;
return $list;
}
add_filter('tscf_filter_codetemplate', 'meta_wc_function', 20, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment