@AH
I have past your code to "prices.php" with total success.
Is there a way to use the the value of variable $discount_percent as a ribbon in picture of product.
I have already the css code in my template, I create the div as follow:
<div class="ribbon"><span>-<?php echo $discount_percent; ?>%</span></div>
in templates/my template/html/com_virtuemart/productdetails/default_images.php, but something qoing wrong with PHP code.
Please take a look at attachment pic.

Thank you in advance.
I use VirtueMart 3.2.12 and Joomla 3.8.3.