Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Contributor Mike Jolley

    (@mikejolley)

    I’ll take a look. Logged an issue for the next release here https://github.com/woothemes/woocommerce/issues/10107

    Hi Mike

    I’m also picking up this issue, also there are no sku’s in the backend orders, front end cart and front end checkout.

    I’ve disabled all plugins (except WC), and reverted to the basic Storefront theme, still no joy.

    Thanks!

    Plugin Contributor Mike Jolley

    (@mikejolley)

    SKUs are never shown in cart – only on the single product pages.

    Ok, I never noticed that! :$

    But they did show in the emails; and they are missing now – so that’s the main issue I’m having.

    Thanks!

    Plugin Contributor Mike Jolley

    (@mikejolley)

    Yeah, it will be fixed in admin emails next update.

    Great, thank you!

    Do you have a quick-fix for this issue until you guys have the next update ready? Our vendors are in big trouble without those SKUs ??

    Plugin Contributor Mike Jolley

    (@mikejolley)

    thank you Mike!

    Awesome! Thanks so much, Mike Jolley!

    Ok, so after the update this works. Thank you.

    However, I have a custom template that sends an order email based on the customers location (via a depot selection on their account) to a specific recipient (not an admin) to process the order. This template still works, but now it doesn’t show the SKU either.

    Could you possibly point out where the issue is in the template code?

    <?php
    
    if (!defined('ABSPATH')) exit; ?>
    
    <?php do_action('woocommerce_email_header', $email_heading); ?>
    
    <h2><?php echo __('Order:', 'woocommerce') . ' ' . $order->get_order_number(); ?></h2>
    
    <table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
    	<thead>
    		<tr>
    			<th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e('Product', 'woocommerce'); ?></th>
    			<th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e('Quantity', 'woocommerce'); ?></th>
    			<th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e('Price', 'woocommerce'); ?></th>
    		</tr>
    	</thead>
    	<tbody>
    		<?php echo $order->email_order_items_table( (get_option('woocommerce_downloads_grant_access_after_payment')=='yes' && $order->status=='processing') ? true : false, true, ($order->status=='processing') ? true : false ); ?>
    	</tbody>
    	<tfoot>
    		<?php
    			if ( $totals = $order->get_order_item_totals() ) {
    				$i = 0;
    				foreach ( $totals as $total ) {
    					$i++;
    					?><tr>
    						<th scope="row" colspan="2" style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
    						<td style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
    					</tr><?php
    				}
    			}
    		?>
    	</tfoot>
    </table>
    
    <?php do_action('woocommerce_email_after_order_table', $order, false); ?>
    
    <p><strong>Payment Method: </strong> <?php echo $order->payment_method.' / '.$order->payment_method_title; ?></p>
    
    <?php if (isset($order->customer_note) && !empty($order->customer_note)): ?>
            <p style="color: #737373;"><strong>Note:</strong> <?php echo wpautop(wptexturize( $order->customer_note )) ?></p>
    <?php endif; ?>
    
    <h2><?php _e('Customer details', 'woocommerce'); ?></h2>
    
    <?php
    $user_info = get_userdata($order->user_id);
    ?>
    <p><strong>Username: </strong> <?php echo $user_info->user_login; ?></p>
    <p><strong>Role(s): </strong> <?php echo implode(', ', $user_info->roles); ?></p>
    <p><strong>User ID: </strong> <?php echo $user_info->ID; ?></p>
    
    <?php if ($order->billing_email) : ?>
    	<p><strong><?php _e('Email:', 'woocommerce'); ?></strong> <?php echo $order->billing_email; ?></p>
    <?php endif; ?>
    <?php if ($order->billing_phone) : ?>
    	<p><strong><?php _e('Tel:', 'woocommerce'); ?></strong> <?php echo $order->billing_phone; ?></p>
    <?php endif; ?>
    
    <?php woocommerce_get_template('emails/email-addresses.php', array( 'order' => $order )); ?>
    
    <?php do_action('woocommerce_email_footer'); ?>

    Thank you!

    Ok, so I did some scratching, and I found that this file woocommerce/includes/abstracts/abstract-wc-order.php on line 1951 the sku is set to false by default. When I changed it to true my email works.

    public function email_order_items_table( $args = array(), $deprecated1 = null, $deprecated2 = null, $deprecated3 = null, $deprecated4 = null, $deprecated5 = null ) {
    		ob_start();
    
    		if ( ! is_null( $deprecated1 ) || ! is_null( $deprecated2 ) || ! is_null( $deprecated3 ) || ! is_null( $deprecated4 ) || ! is_null( $deprecated5 ) ) {
    			_deprecated_argument( __FUNCTION__, '2.5.0' );
    		}
    
    		$defaults = array(
    			'show_sku'   => true,
    			'show_image' => false,
    			'image_size' => array( 32, 32 ),
    			'plain_text' => false
    		);

    I tried to add this to my Woocommerce folder in my child theme, but it only works if I change the original Woocommerce file.

    Any suggestions on the best way of implementing this without modifying the original Woocommerce files?

    Thank you

    I solved this by adding a filter and function in my child theme’s functions.php file.

    // Filter to override includes abstracts abstract-wc-order array defaults to allow SKU to show in email depot-processing-order
    
    add_filter('email_order_items_table');
    // Override includes abstracts abstract-wc-order defaults array for email order items table function
    
    function email_order_items_table($defaults)
    
    {
    			$defaults = array(
    			'show_sku'   => true,
    			'show_image' => false,
    			'image_size' => array( 32, 32 ),
    			'plain_text' => false
    		);
    }
Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘missing SKU from email’ is closed to new replies.