I am isplaying product attributes in my Woocommerce checkout table, see my previous question: Show Woocommerce taxonomy in emails
I also want to show the product image, so my ideal would be: Product image on the left and beside it product name, in the next row product quantity and after that the attribute. If I use this function
add_filter( 'woocommerce_cart_item_name', add_thumbnail_to_cart_items, 10, 3 );
function add_thumbnail_to_cart_items( $product_name, $cart_item, $cart_item_key ){
if ( ! is_checkout() ) return $product_name;
$product = $cart_item['data'];
$thumbnail = $product->get_image(array( 70, 70));
$opening_div = '<div id="checkout_thumbnail" style="float:left; padding-right:15px;">';
return $opening_div . $thumbnail . '</div> ' . $product->get_name();
}
the attribute is not shown any longer. How can I display both?
Updated
The following will display the product image next to its name and the product attribute below:
Code goes in function.php file of your active child theme (or active theme). Tested and works.
The code is based on this related answer:
Displaying product thumbnail and attribute in Woocommerce cart and checkout