• How can I remove the Product SKU from displaying next to the Product Name in the following e-mail’s only? customer-processing-order.php, customer-invoice.php & customer-completed-order.php. My client wants to be able to view the sku when an order comes through, but doesn’t want the customer to be able to view it at any point.

    Any help would be appreciated!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter robbyooooo

    (@robbyooooo)

    Screenshot of what I need to remove.

    I am also trying to figure this one out. Will post if I find a solution.

    Here is the solution I found that worked for me.

    Disable e-mail order items table from e-mail template and copy the function as a custom function into your theme.

    <tbody>
        <?php //echo $order->email_order_items_table( $order->is_download_permitted(), true, ($order->status=='processing') ? true : false );
        echo custom_order_table($order);
        ?>
    </tbody>

    So your custom function will look like:

    function custom_order_table($order) {
    
            foreach($order->get_items() as $item) : 
    
            $_product = $order->get_product_from_item( $item );
    
            $file = $variation = $image = '';
    
            if ($show_image) :
              $src = wp_get_attachment_image_src( get_post_thumbnail_id( $_product->id ), 'thumbnail');
              $image = apply_filters('woocommerce_order_product_image', '<img src="'.$src[0].'" alt="Product Image" height="'.$image_size[1].'" width="'.$image_size[0].'" style="vertical-align:middle; margin-right: 10px;" />', $_product);
            endif;
    
            $return .= '<tr>
              <td style="text-align:left; vertical-align:middle; border: 1px solid #eee;">'. $image . apply_filters('woocommerce_order_product_title', $item['name'], $_product) . $file . $variation . '</td>
              <td style="text-align:left; vertical-align:middle; border: 1px solid #eee;">'.$item['qty'].'</td>';
              $return .= '<td style="text-align:left; vertical-align:middle; border: 1px solid #eee;">';
    
                if ( $order->display_cart_ex_tax || !$order->prices_include_tax ) :
                  $ex_tax_label = ( $order->prices_include_tax ) ? 1 : 0;
                  $return .= woocommerce_price( $order->get_line_subtotal( $item ), array('ex_tax_label' => $ex_tax_label ));
                else :
                  $return .= woocommerce_price( $order->get_line_subtotal( $item, true ) );
                endif;
    
            $return .= '</td></tr>';
    
            // Show any purchase notes
            if ($show_purchase_note) :
              if ($purchase_note = get_post_meta( $_product->id, '_purchase_note', true)) :
                $return .= '<tr><td colspan="3" style="text-align:left; vertical-align:middle; border: 1px solid #eee;">' . apply_filters('the_content', $purchase_note) . '</td></tr>';
              endif;
            endif;
    
          endforeach;
    
          echo $return;
          }

    This is a modified version from here.

    Hi.
    I would like to achieve what you are trying to remove ??

    I.E I would like the SKU to appear in all the emails you have cited above, except I currently only get the SKU to appear in the initial order email; customer-processing-order.php . and Invoice Email customer-invoice.php

    Can you perhaps suggest why this is in my case and how i might correct it for the 3rd email customer-completed-order.php to complete my needs.

    Using : WordPress 3.8.1 & WooCommerce 2.0.20.

    Many Thanks

    Thread Starter robbyooooo

    (@robbyooooo)

    The fix was VERY easy from what I can remember. In customer-processing-order.php, inside the tbody tags I changed the true to false to remove the sku from the e-mail.

    <tbody>
    		<?php echo $order->email_order_items_table( $order->is_download_permitted(), true, $order->has_status( 'processing' ) ); ?>
    	</tbody>

    Below is the code from customer-completed-order.php, I would suggest trying the same with the true / false options in it…

    <tbody>
    		<?php echo $order->email_order_items_table( true, false, true ); ?>
    	</tbody>

    Excellent Fix robbyooooo ! east but very effective.

    I’m now having the problem of SKU’s not showing up on the single product item and of course not in the cart ????

    The really strange thing is that the SKU as you know is showing in the emails.

    Might you have any idea how i can get the SKU to show in the products & cart ??

    Many Thanks 2 U

    Thread Starter robbyooooo

    (@robbyooooo)

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Email Template Remove SKU’ is closed to new replies.