QuestionsHow to Retrieve Custom Fields Values WooCommerce products
mmWebetutorial Staff asked 6 months ago

After successfully created custom fields and saved their values, you’d like to display those values on the frontend. In this case the best method would be to work with WooCommerce custom templates.

To get those values we just need to use the popular get_post_meta() function.

Example:-

<?php
// Display Custom Field Value
echo get_post_meta( $post->ID, ‘field-slug’, true );
// You can also use
echo get_post_meta( get_the_ID(), ‘field-slug’, true );
?>

Your Answer
Login
Enter email and password to comment or answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.