The simplest way to do this is with a plugin. I use ACF (Advanced Custom Fields) to create the meta box which takes care of all the heavy lifting and displays a nice metabox on the edit product screen. I then add a function on my single product template to display the PDF link which can be done using a function or within the template itself where required. Using some conditional logic, the PDF link only displays when there is one 🙂
Here is a snippet for the custom field:
$pdf_media_file = get_post_meta( $post_id, 'pdf_media_file', true);
if(isset($pdf_media_file) && !empty($pdf_media_file)){
$pdf_file = wp_get_attachment_url($pdf_media_file);
}
You can then display the link to the file like this:
<a href="https://wordpress.stackexchange.com/questions/240644/<?php echo $pdf_file; ?>">View the PDF</a>
WordPress has a PDF image generator now so you can also have fun using the PDF thumbnail in the media library.