My Woocommerce site is a marketplace platform and I want to output the image of vendor's store logo (WC Vendors plugin) in the Woocommerce order emails. So when a customer receives the order email they can see the vendor store's logo in the order email. I tried the code below but not sure why the image is not being outputted. In the database, the store logo is placed under _wcv_store_icon_id
.
add_action('woocommerce_email_after_order_table', '_wcv_store_icon_id', 10, 4);
function _wcv_store_icon_id( $order, $sent_to_admin, $plain_text, $email ){
foreach($order->get_items() as $item_values){
// Get the product ID for simple products (not variable ones)
$product_id = $item_values['product_id'];
$vendor_shop = urldecode( get_query_var( 'vendor_shop' ) );
$vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop );
$output = wp_get_attachment_image_src( get_user_meta( $vendor_id, '_wcv_store_icon_id', true ), 'full' );
if ( is_array( $output ) ) {
$img = $output[0];
}
return $img;
}