phpwordpresswoocommerceordersemail-notifications

Product title below the thumbnail in Woocommerce email notifications


How to make the text with the name of the product in the woocommerce email be below the product image? I want the letters to look good.

screenshot


Solution

  • Updated: If the product image are displayed in your email notifications, you can try the following to display the product title under this image:

    add_filter( 'woocommerce_order_item_name', 'product_title_under_thumbnail_emails', 10, 3 );
    function product_title_under_thumbnail_emails( $item_name, $item, $is_visible ) {
        // Targeting view order pages only
        if( is_wc_endpoint_url() )
            return $item_name;
    
        // Get the WC_Product object (from order item)
        $product = $item->get_product();
    
        if( $product->get_image_id() > 0 && $is_visible )
            $item_name = '<br>' . $item_name;
    
        return $item_name;
    }
    

    Code goes in function.php file of your active child theme (or active theme). It should works.