jamesckemp
5/31/2016 - 8:18 AM

Add some custom text (from an ACF field) to the product loop

Add some custom text (from an ACF field) to the product loop

<?php

/*
 * Add this code to your functions.php file
 */
 
add_action( 'woocommerce_after_shop_loop_item_title', 'jck_custom_text', 15 );

function jck_custom_text() {
  the_field('your_field_key');
}

/* -- OR -- */

function jck_custom_text() {
  echo "You can echo any text here";
}

/* -- OR -- */

function jck_custom_text() {
  global $product;
  
  // access the product object
  echo $product->id;
}