I have Advanced Custom Fields setup for post type on WooCommerce Products. So each product has 1 unique custom field.
I'm trying to display the custom field after the product name on the cart and the checkout page and order table information.
However, running into problems as my code doesn't display any output.
Any advice on how to achieve this would be much appreciated. Thanks
// Display the ACF custom field 'location' after the product title on cart / checkout page.
function cart_item_custom_feild( $cart_item ) {
$address = get_field( 'location', $cart_item['product_id'] );
echo "<div>Address: $address.</div>";
}
add_action( 'woocommerce_after_cart_item_name', 'cart_item_custom_feild', 10, 1 );
I also tried the_field
instead of get_field