Hi,
The price with options is calculated dynamically with javascript at the bottom of the "option.php" file of the "product" view.
Also, your code is not correct.
Supposing that your option doesn't have variants, then you can use such code instead:
$price_without_dto= $this->element->prices[0]->price_value_without_discount;
foreach($this->element->options as $optionElement){
$price_without_dto+= $optionElement->prices[0]->price_value;
}
If it has, then it should be something like that (however, this will add the price of all the variants of the option to the main product price so you'll likely want to adapt it based on what you want):
$price_without_dto= $this->element->prices[0]->price_value_without_discount:
foreach($this->element->options as $optionElement){
foreach($optionElement->variants as $variant) {
$price_without_dto+= $variant->prices[0]->price_value;
}
}