You are here

price-difference-formatter.html.twig in Price Difference Formatter 8

Theme override for price_difference_formatter.

Available variables:

  • original_price: The formatted price without the promotion adjustments applied. This includes any other adjustments such as fees, taxes, etc. that were selected in the formatter settings.
  • final_price: The formatted price with all selected adjustments applied.
  • discount_currency: The discount amount formatted in the sites currency (e.g "$49.99")
  • discount_percentage: The discount amount percentage (e.g "20%")

See also

hook_preprocess_price_difference_formatter().

File

templates/price-difference-formatter.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override for price_difference_formatter.
  5. *
  6. * Available variables:
  7. * - original_price:
  8. * The formatted price without the promotion adjustments applied.
  9. * This includes any other adjustments such as fees, taxes, etc.
  10. * that were selected in the formatter settings.
  11. * - final_price:
  12. * The formatted price with all selected adjustments applied.
  13. * - discount_currency:
  14. * The discount amount formatted in the sites currency (e.g "$49.99")
  15. * - discount_percentage:
  16. * The discount amount percentage (e.g "20%")
  17. *
  18. * @see hook_preprocess_price_difference_formatter().
  19. *
  20. */
  21. #}
  22. {%
  23. set classes = [
  24. 'price',
  25. discount_percentage or discount_currency ? 'price-with-discount'
  26. ]
  27. %}
  28. <div{{ attributes.addClass(classes) }}>
  29. {% if original_price != final_price %}
  30. <div class="original-price">
  31. <s>{{ original_price }}</s>
  32. </div>
  33. {% endif %}
  34. {% if discount_percentage %}
  35. <div class="discount-percentage">- {{ discount_percentage }}</div>
  36. {% endif %}
  37. {% if discount_currency %}
  38. <div class="discount-currency">- {{ discount_currency }}</div>
  39. {% endif %}
  40. <div class="final-price">{{ final_price }}</div>
  41. </div>