Search code examples
phpwordpresswoocommercemetadata

Display Woocommerce Metadata value on Frontend


I installed a plugin that displays the metadata of every post (normal posts and products) I would like to be able to display the value of a metadata on the frontend - I am designing a single post (single product) page - and there's a specific metadata field that I would like to display on that page. Any Guidance please? here's a screenshot of the metadata fields that I have: Metadata fields in the dashboard

if you can guide me to display any metadata value, I will be able to do it and choose the desired fields that I want to display on the frontend.

I appreciate your help so much!

I tried different plugins, couldn't find a solution


Solution

  • You must do the following in the file single.php or single-product.php:

        $value = get_post_meta( get_the_ID(), "key", true );
        echo "<p>$value</p>";