Showing product-specific content below the image on a loop item is really easy. In other words, if you want to show content, unique to each individual product below the product featured image on the product loop which appears on the product archive template among other places, this guide is for you. This solution creates you a custom product editor metabox to enter custom text, then displays it under the product image.
/**
* Snippet Name: WooCommerce Custom Product Metabox For Content Below Image On Loop Item
* Snippet Author: ecommercehints.com
*/
add_action ('woocommerce_product_options_advanced', 'ecommercehints_product_data_metabox');
function ecommercehints_product_data_metabox() {
echo '';
woocommerce_wp_text_input (array (
'id' => 'custom_loop_content_below_image',
'value' => get_post_meta (get_the_ID(), 'custom_loop_content_below_image', true),
'label' => 'Custom Loop Content',
'description' => 'Text to appear below loop image'
));
echo '';
}
add_action ('woocommerce_process_product_meta', 'ecommercehints_save_field_on_update', 10, 2);
function ecommercehints_save_field_on_update ($id, $post) {
update_post_meta ($id, 'custom_loop_content_below_image', $_POST['custom_loop_content_below_image']);
}
add_action( 'woocommerce_shop_loop_item_title', 'ecommercehints_woocommerce_shop_loop_item_title', 1, 0 );
function ecommercehints_woocommerce_shop_loop_item_title() {
global $product;
$custom_loop_content_below_image = $product->get_meta ('custom_loop_content_below_image');
echo $custom_loop_content_below_image;
};