Commerce Single Price Formatter

Component ID

2906734

Component name

Commerce Single Price Formatter

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

106

Component created

Component changed

Component body

This module came in as an idea while trying to display a column containing only the discount components of a price in the commerce cart view page. I first tried using the Commerce Extra Price Formatters which had a very good logic in it but the implemented formatters didn't do exactly what I needed. This module, instead of predefining a set of formatters, defines only one formatter which tries to fit all needs.

Credit: Some ideas (eg. prefix/suffix) were taken from the Commerce Extra Price Formatters contrib module.

The administrator may use the formatter Price with optional prefix/suffix in entity display or in views and has the following options:

  • Components: Choose the component(s) you want to display as a summed amount.
  • Prefix: Add a prefix to your formatted price.
  • Suffix: Add a suffix to your formatted price.
  • Zero price formatted: This is important if you use this formatter in a view table to display ex. a Discount column. If you don't always need this column displayed, then the formatter should return 0 instead of $0,00. Don't forget to also check the Hide empty column checkbox in the views table format settings.