Last active
February 25, 2021 12:50
-
-
Save PechenkiUA/d7411443425b7e0aa17c8b71809afb8c to your computer and use it in GitHub Desktop.
add fiter shortcode telsender 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 | |
/* Telsender add action*/ | |
function meta_wc_function ($list, $order_id){ | |
$order = wc_get_order( $order_id); | |
$items = $order->get_items(); | |
$product_f = ''; | |
foreach ( $items as $item) { | |
$product_item = $item->get_product(); | |
if ($product_item) { | |
$meta_data = ''; | |
foreach($item->get_meta_data() as $k=>$value){ | |
$meta_data .= $value->key .': '.$value->value.' ' ; | |
} | |
$option = $product_item->get_data(); | |
$sku = $product_item->get_sku(); | |
$product_f .= $item['name'].' x'.$item['quantity'].' '.$item['total'].$curents.' '.' ('. $meta_data .')'.chr(10); | |
} | |
} | |
$list['{product_f}'] = $product_f; | |
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