app/template/yamaria/Block/ecommerce.twig line 1

Open in your IDE?
  1. {% if app.request.pathinfo == '/shopping/complete' %}
  2. <script>
  3.         var transaction_products = [];
  4.         {% for OrderItem in Order.MergedProductOrderItems %}
  5.         transaction_products.push({
  6.             sku: '{{ OrderItem.product_code ? OrderItem.product_code : OrderItem.product.id }}',
  7.             name: '{{ OrderItem.product_name }}',
  8.             price: '{{ OrderItem.price_inc_tax }}',
  9.             quantity: '{{ OrderItem.quantity }}'
  10.         });
  11.         {% endfor %}
  12.         window.dataLayer = window.dataLayer || []
  13.         dataLayer.push({
  14.             'transactionId': '{{ Order.order_no ? Order.order_no : Order.id }}',
  15.             'transactionTotal': {{ Order.payment_total }},
  16.             'transactionProducts': transaction_products
  17.         });
  18. </script>
  19. {% endif %}