Skip to content

Instantly share code, notes, and snippets.

@PechenkiUA
Created October 24, 2023 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PechenkiUA/3b2d03111df0bcb567dc767c2a030e7d to your computer and use it in GitHub Desktop.
Save PechenkiUA/3b2d03111df0bcb567dc767c2a030e7d to your computer and use it in GitHub Desktop.
decode images file wc
<?php
add_filter('tscf_filter_codetemplate', function ($list, $order_id) {
$order = wc_get_order($order_id);
$file = get_post_meta($order->get_id(), '_billing_upload_main', true);
$file_path = '';
if ($file) {
$file_arr = json_decode($file,true);
if ($file_arr) {
foreach ($file_arr as $key => $value) {
$file_path .= sprintf('<a href="%s">%s</a> ', $value['url'], $value['name']);
$file_path .= PHP_EOL;
}
}
$list['{file}'] = $file_path;
}
return $list;
}, 20, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment