After creating custom fields with ACF, we need to Add this code to Functions.php file.
/*
* single product page custom fields
*/
function talha_display_acf_custom_acf_fields_on_single_prod_page() {
$prod_origin = get_field('product_origin');
$prod_type = get_field('product_type');
$prod_postage = get_field('free_postage');
$prod_pack_size = get_field('pack_size');
$prod_brand = get_field('brand');
$prod_flavour_group = get_field('flavor_groups');
$prod_flavour_notes = get_field('flavor_notes');
$prod_juice_mix = get_field('juice_mix');
$prod_strengths_in_stock = get_field('strengths_in_stock');
$prod_model_no = get_field('model_no');
$prod_color = get_field('color');
$prod_safety_warrning = get_field('safety_warning');
$prod_warranty = get_field('warranty');
$prod_battery_size = get_field('battery_size');
$prod_compatible_with = get_field('compatible_with');
$prod_buitin_battery = get_field('built_in_battery');
$prod_tank_capacity = get_field('tank_capacity');
$prod_connection_ = get_field('connection_');
$prod_juice_filling = get_field('juice_filling');
$prod_diameter = get_field('diameter');
$prod_ohm = get_field('ohm');
$prod_ohm_variations = get_field('ohm_variations');
$prod_pod_type = get_field('pod_type');
$prod_squonk_pin = get_field('squonk_pin');
$prod_flavour = get_field('flavour');
$prod_nicotine = get_field('nicotine');
$prod_ingredients = get_field('ingredients');
$prod_cbd_percentage = get_field('cbd_percentage');
if ($prod_cbd_percentage)
{
echo '<b>CBD %:</b> ' . $prod_cbd_percentage;
echo '<br />';
}
if ($prod_nicotine)
{
echo '<b>Nicotine:</b> ' . $prod_nicotine;
echo '<br />';
}
if ($prod_ingredients)
{
echo '<b>Ingredients:</b> ' . $prod_ingredients;
echo '<br />';
}
if ($prod_flavour)
{
echo '<b>Flavour:</b> ' . $prod_flavour;
echo '<br />';
}
if ($prod_squonk_pin)
{
echo '<b>Squonk Pin:</b> ' . $prod_squonk_pin;
echo '<br />';
}
if ($prod_origin)
{
echo '<b>Product Origin:</b> ' . $prod_origin;
echo '<br />';
}
if ($prod_type)
{
echo '<b>Product Type:</b> ' . $prod_type;
echo '<br />';
}
if ($prod_postage)
{
echo '<b>Free Postage:</b> ' . $prod_postage;
echo '<br />';
}
if ($prod_pack_size)
{
echo '<b>Pack Size(s):</b> ' . $prod_pack_size;
echo '<br />';
}
if ($prod_brand)
{
echo '<b>Brand:</b> ' . $prod_brand;
echo '<br />';
}
if ($prod_flavour_group)
{
echo '<b>Flavour Groups:</b> ' . $prod_flavour_group;
echo '<br />';
}
if ($prod_flavour_notes)
{
echo '<b>Flavour Notes:</b> ' . $prod_flavour_notes;
echo '<br />';
}
if ($prod_juice_mix)
{
echo '<b>Juice Mix:</b> ' . $prod_juice_mix;
echo '<br />';
}
if ($prod_strengths_in_stock)
{
echo '<b>Strength(s) In Stock: </b> ' . $prod_strengths_in_stock;
echo '<br />';
}
if ($prod_buitin_battery)
{
echo '<b>Built-in Battery:</b> ' . $prod_buitin_battery;
echo '<br />';
}
if ($prod_compatible_with)
{
echo '<b>Compatible with:</b> ' . $prod_compatible_with;
echo '<br />';
}
if ($prod_battery_size)
{
echo '<b>Battery Size:</b> ' . $prod_battery_size;
echo '<br />';
}
if ($prod_warranty)
{
echo '<b>warranty:</b> ' . $prod_warranty;
echo '<br />';
}
if ($prod_safety_warrning)
{
echo '<b>Safety Warrning:</b> ' . $prod_safety_warrning;
echo '<br />';
}
if ($prod_color)
{
echo '<b>Color:</b> ' . $prod_color;
echo '<br />';
}
if ($prod_model_no)
{
echo '<b>Model No:</b> ' . $prod_model_no;
echo '<br />';
}
if ($prod_tank_capacity)
{
echo '<b>Tank Capacity:</b> ' . $prod_tank_capacity;
echo '<br />';
}
if ($prod_connection_)
{
echo '<b> Connection:</b> ' . $prod_connection_;
echo '<br />';
}
if ($prod_juice_filling)
{
echo '<b> juice filling:</b> ' . $prod_juice_filling;
echo '<br />';
}
if ($prod_diameter)
{
echo '<b> Diameter:</b> ' . $prod_diameter;
echo '<br />';
}
if ($prod_ohm)
{
echo '<b> Ohm:</b> ' . $prod_ohm;
echo '<br />';
}
if ($prod_ohm_variations)
{
echo '<b>Ohm Variations:</b> ' . $prod_ohm_variations;
echo '<br />';
}
if ($prod_pod_type)
{
echo '<b>Pod Type:</b> ' . $prod_pod_type;
echo '<br />';
}
// Note: 'product_origin' is the slug of the ACF
}
add_action( 'woocommerce_after_add_to_cart_button', 'talha_display_acf_custom_acf_fields_on_single_prod_page', 30 );