I think I need to add the $options parameter in the static method formatPrice in the PriceTwigExtension.

https://git.drupalcode.org/project/commerce/blob/8.x-2.x/modules/price/s...

This will allow more flexibility to use the filter from the template, for example commerce-order-total-summary.html.twig
Example {{ totals.subtotal|commerce_price_format({'minimum_fraction_digits': 0}) }}

Also add here:
https://git.drupalcode.org/project/commerce/blob/8.x-2.x/modules/price/s...

Comments

lukasss created an issue. See original summary.

lukasss’s picture

lukasss’s picture

Status: Active » Needs review
capysara’s picture

Works great and patch applies cleanly. I used the example in the issue summary to remove trailing zeroes in prices. I'm using Drupal 8.8.4 and Commerce 8.x-2.17. Thanks!

jsacksick’s picture

StatusFileSize
new3.68 KB

Committing the attached patch that adds tests coverage.

  • jsacksick committed bbda496 on 8.x-2.x authored by lukasss
    Issue #3060519 by lukasss, jsacksick: Allow passing options to the price...
jsacksick’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.