Woo SKUs not picking up

Hi X,


I had an order for tamanu oil come through, but the SKU wasn’t attached!? I know it was the smaller size, since it was $18, but I don’t know why the SKU didn’t pick up. The order should have been charged $7 (the shipping charge for tamanu), but since there was no SKU it charged the lower amount ($4 for kaolin clay).

I checked and the SKUs for both sizes appear to be fine. What could I be missing? Thanks.

Hi,

Thanks for writing in!

This is more of woocommerce issue rather than the theme.

You can try adding the code below in your child theme’s functions.php file

/**
 * Adds product SKU to the WooCommerce order details page
 * Uses WooCommerce 2.5 or newer
 */
add_action( 'woocommerce_add_order_item_meta', 'jk_add_item_sku', 10, 3 );
function jk_add_item_sku( $item_id, $values, $cart_item_key ) {

  $item_sku = get_post_meta( $values[ 'product_id' ], '_sku', true );

  wc_add_order_item_meta( $item_id, 'sku', $item_sku , false );

}

Note: this won’t do anything to existing orders, it will only work on orders that are made after the script is on the site.

Hope this helps

Thank you very much!

We are delighted to assist you with this.

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.