0
votes

when i show a few products on a wordpress page from a woocommerce product table i would like to show the short description + a link to an associated pdf ( ideally using a pdf icon as the link )

i have managed to get the short description to show by using the following code - but how do i add something in the meta data that's been added to the product as ( Meta: pdf_link ) - it's a url to a .pdf file

add_action( 'woocommerce_after_shop_loop_item', 'woo_show_excerpt_shop_page', 5 );

function woo_show_excerpt_shop_page() { global $product;

echo $product->post->post_excerpt;

.
}

i'm assuming i can just add another line like:

echo $product->post->pdf_link;

???

but i cant work it out...

1

1 Answers

0
votes

You might try this:

$pdf_link = get_post_meta( $product->id, 'pdf_link', true );

echo $pdf_link;