cancel
Showing results for 
Search instead for 
Did you mean: 

Add text price from if product has custom options Magento 2

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Add text price from if product has custom options Magento 2

Please help me on that.

 

I want to display some text(Price From) before to the price of a product if it has custom options in simple product. I have placed some code in final_price.phtml but it doesn't show the message on custom option products. Can anyone please advise an update to the below to get this working?

 

<span class="special-price">
/** Show text if has custom option */ <?php if ($block->hasOptions()):?>
<?php echo ('from'); ?>
<?php endif;?> /** Show text if has custom option */
<?php /* @escapeNotVerified */ echo $block->renderAmount($finalPriceModel->getAmount(), [
'price_id' => $block->getPriceId('product-price-' . $idSuffix),
'price_type' => 'finalPrice',
'include_container' => true,
'schema' => $schema
]); ?>
</span>