WooCommerce get custom product attribute. As attributes are always prepend with pa_ in DB, for getting them with wc_get_product_terms() function, you will need to use pa_pdfs instead of pdfs, this way:
// Added WC 3+ support
$product_id = method_exists( $product, 'get_id' ) ? $product->get_id() : $product->id;
$myPdf = array_shift( wc_get_product_terms( $product_id, 'pa_pdfs', array( 'fields' => 'names' ) ) );
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.