In WooCommerce I would like to add custom text to my products display, that will be grabbed from a custom field in product\'s edit page.
This is how it looks now:
Updated:
Try this custom hooked function, that will display your custom field value below product title:
add_action( 'woocommerce_after_shop_loop_item_title', 'custom_field_display_below_title', 2 );
function custom_field_display_below_title(){
global $product;
// Get the custom field value
$custom_field = get_post_meta( $product->get_id(), '_custom_product_text_field', true );
// Display
if( ! empty($custom_field) ){
echo '<p class="my-custom-field">'.$custom_field.'</p>';
}
}
Code goes in function.php file of your active child theme (or active theme).
It should work.
For anyone trying to implement this, the closing div is missing from function woocommerce_product_custom_fields(). Add echo ''; before the closing curly bracket otherwise all of the other product data tabs in the product settings will be empty.