Add SKU in cart page detail - WooCommerce

In default, WooCommerce offer minimal information about product on cart page. Often I miss SKU of product on this page & always like to add this unique identifier on these pages.

To add SKU on cart page, we can simply use a filter hook on Item Name.

add_filter( 'woocommerce_cart_item_name', 'add_sku_in_cart', 20, 3);

function add_sku_in_cart( $title, $values, $cart_item_key ) {
	$sku = $values['data']->get_sku();
	return $sku ? $title . sprintf(" (SKU: %s)", $sku) : $title;
}

Need Help?

Do you need any help on WooCommerce & WordPress? I'm happy to help you.

Contact Me

Recent Posts

  1. Move files recursively from source to remote server - SCP Command
  2. Brief about Magento 2 cache commands
  3. Magento 2 customer account password options
  4. Enable or disable maintance mode - Magento 2
  5. Replace string in multiple files - Command line


Questions / Comments

If you found this article interesting, found errors, or just want to discuss about them, please get in touch.