Adding product SKU before cart item name in WooCommerce

You just need to change a bit your code this way, to get the SKU before the product name:

function show_sku_in_cart_items( $item_name, $cart_item, $cart_item_key ) {
    // The WC_Product object
    $product = $cart_item['data'];

    // Get the  SKU
    $sku = $product->get_sku();

    // When SKU doesn't exist
    if ( empty( $sku ) ) 
        return $item_name;

    // Add SKU before
    if ( is_cart() ) {
        $item_name="<small class="product-sku">" . '<span class="sku-title">' . __( "SKU: ", "woocommerce") . '</span>' . $sku . '</small><br>' . $item_name;
    } else {
        $item_name="<small class="product-sku">" . $sku . '</small>' . $item_name;
    }

    return $item_name;
}

add_filter( 'woocommerce_cart_item_name', 'show_sku_in_cart_items', 99, 3 );

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)