Add custom field link through functions.php
-
I am trying to add a custom field I’ve created to my single product page in WooCommerce.
The field is a url – product_brochure
Here is the action I am using:
add_action( 'woocommerce_single_product_summary', 'poppy_pdf_brochure', 20); function poppy_pdf_brochure() { echo '<a href=" <?php the_field("product_brochure"); ?> " >Download The Brochure</a>'; }
But it won’t display it as a link. echo the_field(‘product_brochure’); is working but just displaying the full URL. I’ve tried so many different ways of doing this but just can’t figure out how to do it – would really appreciate anyones help!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Add custom field link through functions.php’ is closed to new replies.