A Complete Tutorial for WooCommerce Show SKU @ Cart page

Featuring SKU code under every product page is sometimes must. Such displays are important for the knowledge of buyers at times. Especially, in case of B2B businesses & international brands, this display can help! In this tutorial, you will learn about WooCommerce Show SKU @ cart pages. 

Here is a screenshot showing SKU in cart pages:

Image displaying WooCommerce show SKU at cart pages functionality

PHP Snippet: Display SKU @ Cart page

So, this SKU number appears below the item name at the cart page. 


add_action( 'woocommerce_after_cart_item_name', 'phpsof_sku_below_cart_item_name', 11, 2 );
 
function phpsof_sku_below_cart_item_name( $cart_item, $cart_item_key ) {
   $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
   $sku = $_product->get_sku();
   if ( ! $sku ) return;
   echo '<p><small>SKU: ' . $sku . '</small></p>';
}

Where do you add this snippet?

So, enable this WooCommerce Show SKU at Cart pages. You can add this PHP snippet at your child theme function.php file’s bottom. It should be placed before “?>”, if you have it there. Apart from this, CSS goes in your child theme style.css file. 

Is this snippet still valid?  

So, this is how you can display WooCommerce Show SKU at Cart pagesI have applied this code on the Storefront theme and WordPress friendly hosting PHP 7.3. Let me know if everything works as expected. Share it further if this snippet has saved your time.  

Also Read, WooCommerce Get Product Info (ID SKU $) from $product object

A Guide to WooCommerce Hide Mini-Cart Widget (Dropdown)

Important links: WooCommerce – https://woocommerce.com/