Sarathlal N

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;
}

Got a project in mind? Send me a quick message, and I'll get back to you within 24 hours!.

Recent Posts

  1. Disabling Payment Methods in WooCommerce Based on Conditions
  2. How to Update Product Quantity in WooCommerce Using Custom Code
  3. Dynamically Generating a Table of Contents in WordPress
  4. Direct Checkout in WooCommerce - Add Product to Cart from Checkout Page & Skip Shop, Product, and Cart Pages
  5. Understanding the Impact of git reset --hard Command

Your Questions / Comments

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