Dear community, I would like to ask for help.
I am building a Pricing Table with ACF repeater, which is perfectly fine, until I want to do some VAT calculations between sub_fields. Is it possible to access current ACF repeater row sub_fields from code block?
I tried to use the basic get_sub_field because I am already in ACF repeater, but without a luck. If I use the whole ACF repeater loop in code block, I get all repeater rows which I dont want.
Mine code:
// ZĂskánĂ hodnoty z pole fve_price
$fve_price = get_sub_field('fve_price');
// Výpočet DPH (12% z ceny s DPH)
$dph = $fve_price * 0.12;
// Výpočet ceny bez DPH
$price_excluding_vat = $fve_price - $dph;
// FormátovánĂ ÄŤĂsel pro vĂ˝pis
$formatted_fve_price = number_format($fve_price, 0, '.', ' ');
$formatted_price_excluding_vat = number_format($price_excluding_vat, 0, '.', ' ');
$formatted_dph = number_format($dph, 0, '.', ' ');
// Výpis ceny s DPH
echo "Cena s DPH: {$formatted_fve_price} KÄŤ<br>";
// Výpis ceny bez DPH
echo "Cena bez DPH: {$formatted_price_excluding_vat} KÄŤ<br>";
// Výpis DPH
echo "DPH: {$formatted_dph} KÄŤ<br>";
// ZĂskánĂ hodnoty z pole fve_dotace
$fve_dotace = get_sub_field('fve_dotace');
// Výpočet ceny po odečtenà dotace
$price_after_subsidy = $fve_price - $fve_dotace;
$formatted_price_after_subsidy = number_format($price_after_subsidy, 0, '.', ' ');
// Výpis ceny po odečtenà dotace
echo "Cena po odeÄŤtenĂ dotace: {$formatted_price_after_subsidy} KÄŤ<br><br>";
