4

I know similar questions have been asked dozens of times but I'm just not understanding how to display custom fields. I'm using woocommerce and want to display a custom field value on product pages.

I add the custom field "current_promotions" and a value to a product, and have tried adding this to the content-product.php template, but I'm getting nowhere:

<?php $postid = get_the_ID(); ?>

<?php get_post_meta($post_id, $key, $single); ?>

1 Answer 1

10

This should do it

<?php echo get_post_meta( get_the_ID(), 'current_promotions', true ); ?>

Not the answer you're looking for? Browse other questions tagged or ask your own question.