Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
telsender link product
<?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