Code is tested with 2019 theme. Open the functions.php file of your active theme and drop this code at end of the file.
add_action( 'woocommerce_after_shop_loop_item', 'wpse2019_add_pdf_download_button', 10 );
function wpse2019_add_pdf_download_button() {
global $product;
if( $product ) {
printf( '<a href="https://wordpress.stackexchange.com/questions/329837/%s" class="pdf-button button btn" role="button">%s</a>', "YOUR PDF LINK HERE", __( 'DWONLOAD PDF', 'text-domain' ) );
}
}
default add to cart and select options buttons are adding via woocommerce_after_shop_loop_item hook (source: templates/archive-product.php). I use the same hook and add the 2nd custom button. You will replace YOUR PDF LINK HERE with your PDF link.
If you will add different PDF file for every product, you will use the custom field logic. You can use the WordPress native custom field option or some free plugin like ACF/PODs/CMB2 etc
Assume your custom field would be wc_product_pdf_file. Then you can try this code
add_action( 'woocommerce_after_shop_loop_item', 'wpse2019_add_pdf_download_button', 10 );
function wpse2019_add_pdf_download_button() {
global $product;
if( $product ) {
$pdf_link = get_post_meta( $product->get_id(), 'wc_product_pdf_file', true );
if( ! empty( $pdf_link ) ) {
printf( '<a href="https://wordpress.stackexchange.com/questions/329837/%s" class="pdf-button button btn" role="button">%s</a>', $pdf_link, __( 'DWONLOAD PDF', 'text-domain' ) );
}
}
}
get_post_meta function is fetching the post meta data. $product->get_id() is giving the current product ID.
Note: Before editing the file, you keep a backup of your theme.