Created
October 24, 2023 19:14
-
-
Save PechenkiUA/3b2d03111df0bcb567dc767c2a030e7d to your computer and use it in GitHub Desktop.
decode images file wc
This file contains 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('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