February 7, 2016 at 10:16 pm
Hi,
I’ve been working on adding some custom fields to my woocommerce products, something I’m entirely new with. I found a helpful post here on adding multiple custom fields and was able to add them to my single product pages by following the steps and adding the code to functions.php.
What I would like to do now is have those custom fields display under the thumbnails of the featured products I have displaying on my home page. I would like to have these fields display between the product title and price, if possible. I’m working locally, but I can show you what I’ve got so far:
add_action( 'woocommerce_single_product_summary', 'kt_add_custom_field', 15 );
function kt_add_custom_field() {
global $post;
echo '<div class="release-info, ri-artist">'.get_post_meta( $post->ID, 'wpcf-artist', true ).'</div>';
echo '<div class="release-info, ri-title">'.get_post_meta( $post->ID, 'wpcf-title', true ).'</div>';
echo '<div class="release-info, ri-date">Released: '.get_post_meta( $post->ID, 'wpcf-date', true ).'</div>';
echo '<div class="release-info, ri-format">Format: '.get_post_meta( $post->ID, 'wpcf-format', true ).'</div>';
}
Thanks for your help!
-Adam