Created
May 2, 2022 08:09
-
-
Save PechenkiUA/481f6b668338a24dbf3f5d769d036746 to your computer and use it in GitHub Desktop.
telsender link product
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 | |
/* Telsender link product */ | |
function meta_wc_function_link($list, $order_id) | |
{ | |
$order = wc_get_order($order_id); | |
$items = $order->get_items(); | |
$curents = get_woocommerce_currency_symbol(); | |
$product = ''; | |
$product_v3 = ''; | |
$product_v2 = ''; | |
foreach ($items as $item) { | |
$metaProduct = $item->get_formatted_meta_data(); | |
$metaText = ''; | |
foreach ($metaProduct as $key => $value) { | |
$metaText .= $value->display_key . ' : ' . $value->value . chr(10); | |
} | |
$product_item = $item->get_product(); | |
if ($product_item) { | |
$sku = $product_item->get_sku(); | |
$product .= '<a href="' . get_the_permalink($product_item->get_id()) . '">Link</a> ' . $item['name'] . ' x' . $item['quantity'] . ' ' . $item['total'] . $curents . chr(10); | |
$product_v2 .= '<a href="' .get_the_permalink($product_item->get_id()) . '">Link</a> ' . $item['name'] . ' x' . $item['quantity'] . ' ' . $item['total'] . $curents . ' sku(' . $sku . ')' . chr(10); | |
$product_v3 .= '<a href="' . get_the_permalink($product_item->get_id()) . '">Link</a> ' . $item['name'] . ' x' . $item['quantity'] . ' ' . $item['total'] . $curents . ' ' . $metaText . chr(10); | |
} | |
} | |
$list['{product_link}'] = $product; | |
$list['{product_link_v2}'] = $product_v2; | |
$list['{product_link_v3}'] = $product_v3; | |
return $list; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment