I want to display the value from an Advanced Custom Field (ACF) in Woocommerce and I am using this code in this function hooked:
add_action( 'woocommerce_single_product_summary', 'charting', 20 );
function charting() {
if( get_field('size_chart') ) {
echo '<p><a href="'.the_field('size_chart').'" data-rel="prettyPhoto">size guide</a></p>';
}
return;
}
But it is not working, it is displaying the custom field value above the href (size guide) and the href is empty like this:
<a href="" data-rel="prettyPhoto">size guide</a>
var_dump(the_field('size_chart'));
? – helgatheviking