vendor/store.shopware.com/mediameetsfbpixel/src/Resources/views/storefront/plugin/mediameets-fb-pixel/product-data.html.twig line 1

Open in your IDE?
  1. {% if config('mediameetsFbPixel.config.pixelIds') and config('mediameetsFbPixel.config.pixelIds') is not empty %}
  2.     {% if page.product.calculatedPrices|length > 1 %}
  3.         {% set _mmfbProductPrice = page.product.calculatedPrices|first %}
  4.     {% else %}
  5.         {% set _mmfbProductPrice = page.product.calculatedPrice %}
  6.         {% if page.product.calculatedPrices|length == 1 %}
  7.             {% set _mmfbProductPrice = page.product.calculatedPrices.first %}
  8.         {% endif %}
  9.     {% endif %}
  10.     {% set _mmfbProductCategory = page.header.navigation.getChildren(page.product.categoryTree|last) %}
  11.     <script>
  12.         window.mediameetsFacebookPixelData.set('product', {
  13.             name: '{{ page.product.translated.name|e('js') }}',
  14.             productNumber: '{{ page.product.productNumber|e('js') }}',
  15.             price: {{ _mmfbProductPrice.unitPrice|number_format(2, '.', '')|e('js') }},
  16.             category: '{{ _mmfbProductCategory.active.translated.name|e('js') }}'
  17.         });
  18.     </script>
  19. {% endif %}