Reference product SKU on WooCommerce confirmation page [closed]

The solution was simple, in the end. After grabbing the item ID, I had to query the product class:

$productmeta = new WC_Product($id);
$sku = $productmeta->post->sku;

Then insert $sku instead of $id on the output. It took me about 30min to figure that out. Perhaps it’ll be useful to someone else in the future. I placed the final code on Pastebin.