Woocommerce displays individual item price in checkout, but not in order confirmations.
I don’t need it to display a new column. Something simple like ($x.xx each)
after the item name.
All of my pricing is based off variations, so I modified the code below to display variation descriptions, then I manually enter the “$x.xx each” as the description. It should be pretty easy to modify this to display price instead, but I can’t seem to figure it out.
I just need to know how to change $_var_description
to show price instead of description. Thanks!
add_filter('woocommerce_order_item_name', 'display_product_title_as_link', 10, 2);
function display_product_title_as_link($item_name, $item)
{
$_product = get_product($item['variation_id'] ? $item['variation_id'] : $item['product_id']);
$link = get_permalink($_product->id);
$_var_description = '';
if ($item['variation_id']) {
$_var_description = $_product->get_variation_description();
}
if ($_var_description) {
return '' . $item_name . ' (' . $_var_description . ')';
} else {
return '' . $item_name;
}
}
Expected results is on order confirmations it will say Item name + individual price instead of item name.
2
Answers
Add the follows code snippet to do the above –
I change a bit itzmekhokan code and use this on my web, and it’s work show single price on checkout page