When SKU matters to the end users, then displaying it in the Cart page under each item’s name is a must.

Ideal for B2B businesses and international brands, this simple edit can actually help you learn how to add any sort of content under the Cart item names. Simply use the same hook and maybe try to get something different than SKU with this guide. Enjoy!

With this handy snippet, echoing the SKU under each item in the Cart page is a breeze!

PHP Snippet: Display SKU Below Item Names @ Cart

/**
 * @snippet       Show SKU @ WooCommerce Cart
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @testedwith    WooCommerce 4.1
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */

add_action( 'woocommerce_after_cart_item_name', 'bbloomer_sku_below_cart_item_name', 11, 2 );

function bbloomer_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>';
}
Share:

Leave a Reply