// Get all the categories for the given product
$categories = wp_get_post_terms( $product->ID, 'product_cat' );
// Explode the (hopefully) comma-separated list of member IDs into an array
- $member_ids_for_product = explode(',',get_post_meta( $product->ID, 'trail_id', true));
+ $member_ids_for_product = explode(',', get_field( 'trail_id', $product->ID ) );
// If the current member is in the list of IDs
if (in_array($member_id, $member_ids_for_product)) {