# Runden beim Preisexport

**URL:** <https://forum.shopware.com/t/runden-beim-preisexport/90539>\
**Category:** Shopware 6 (German)\
**Created:** [24. September 2021 um 17:59 UTC](https://forum.shopware.com/t/runden-beim-preisexport/90539 "2021-09-24T17:59:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![enbitcon](https://avatars.discourse-cdn.com/v4/letter/e/7993a0/32.png) [@enbitcon](https://forum.shopware.com/u/enbitcon)\
**Post date:** [24. September 2021 um 17:59 UTC](https://forum.shopware.com/t/runden-beim-preisexport/90539/1 "2021-09-24T17:59:54Z")

</div>

Hallo zusammen,

ich verzweifel gerade beim Runden von Preisen im Preisvergleich.  
Der Shop steht auf netto. Ich muss aber Brutto an Google melden.

also habe ich das hier „gebaut“

```auto

 {% set price = product.calculatedPrice %}
    {% if product.calculatedPrices.count > 0 %}
        {% set price = product.calculatedPrices.last %}
    {% endif %}

    <g:price>{{ price.unitPrice*1.19|number_format(context.currency.itemRounding.decimals, '.', '') }} {{ context.currency.isoCode }}</g:price>

```

Überwiegend aus der Vorlage von Shopware. Das Problem ist nun, dass ich teilweise bis zu 5 nachkommestellen habe. Kann mir jemand helfen und mir sagen, wie ich das auf 2 Nachkommestellen gerundet bekomme?

---

<div class="post-metadata">

**Author:** ![Max\_Shop](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Max\_Shop](https://forum.shopware.com/u/Max_Shop)\
**Post date:** [24. September 2021 um 18:20 UTC](https://forum.shopware.com/t/runden-beim-preisexport/90539/2 "2021-09-24T18:20:21Z")

</div>

[https://twig.symfony.com/doc/3.x/filters/number\_format.html](https://twig.symfony.com/doc/3.x/filters/number_format.html)

---

<div class="post-metadata">

**Author:** ![enbitcon](https://avatars.discourse-cdn.com/v4/letter/e/7993a0/32.png) [@enbitcon](https://forum.shopware.com/u/enbitcon)\
**Post date:** [24. September 2021 um 19:03 UTC](https://forum.shopware.com/t/runden-beim-preisexport/90539/3 "2021-09-24T19:03:52Z")

</div>

```auto
 {% set price = product.calculatedPrice %}
    {% if product.calculatedPrices.count > 0 %}
        {% set price = product.calculatedPrices.last %}
    {% endif %}

    <g:price>{{ price.unitPrice*1.19|number_format(2 , '.', '') }} {{ context.currency.isoCode }}</g:price>

```

Habe ich schon probiert Passiert leider nichts. So als ob es keine Zahl sei…

---

<div class="post-metadata">

**Author:** ![martinz](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@martinz](https://forum.shopware.com/u/martinz)\
**Post date:** [23. November 2021 um 07:16 UTC](https://forum.shopware.com/t/runden-beim-preisexport/90539/4 "2021-11-23T07:16:27Z")

</div>

Keine Ahnung ob dein Problem noch aktuell ist. Ich bin aber auch gerade mit dem Shopping Feed am kämpfen ☹

Hier mal meine Lösung:

```auto
   <g:price>{{ product.purchaseSteps * (1.19*price.unitPrice)|number_format(context.currency.itemRounding.decimals, '.', '') }} {{ context.currency.isoCode }}</g:price>

```

---

<div class="post-metadata">

**Author:** ![enbitcon](https://avatars.discourse-cdn.com/v4/letter/e/7993a0/32.png) [@enbitcon](https://forum.shopware.com/u/enbitcon)\
**Post date:** [23. November 2021 um 08:01 UTC](https://forum.shopware.com/t/runden-beim-preisexport/90539/5 "2021-11-23T08:01:13Z")

</div>

Hi

danke für deine ANtwort. Ein Entwickler hat uns das hier eingetragen:

```auto
 {% set price = product.calculatedPrice %}
    {% if product.calculatedPrices.count > 0 %}
        {% set price = product.calculatedPrices.last %}
    {% endif %}
    {% set tax = price.calculatedTaxes.first %}

    <g:price>{{ price.totalPrice + tax.tax|number_format(context.currency.itemRounding.decimals, '.', '') }} {{ context.currency.isoCode }}</g:price>

```

Somit haben wir jetzt 2 Lösungsvorschläge
