Under:
Butiksinställningar > Kassa & Betalning finns ett fält för Extra innehåll eller script.
Detta fält är till för att lägga till script och tjänster som behöver information om kunders köp.
Några tjänster som kräver sådan information är:
- Trustpilot
- Hello retail
- Divvit
- Cashback world
- Facebook pixel
- adrecord
- mm
Dom vanligaste parametrarna som tjänsterna behöver är:
- Ordernummer.
- Ordervärde.
- valuta
- produkter som finns i ordern
För att få in dom parametrarna så använder vi Pandas taggar som ger tillgång till orderns data. Några vanliga är:
- Ordernummer/order id = {{ order_number }}
- Ordervärde utan skatt = {{ line_items_price_excluding_tax }}
- Ordervärde med skatt = {{ line_items_price }}
- moms = {{ tax_price }}
- Totalpris = {{ total_price }}
- Fraktkostnad = {{ shipping_price }}
- Total Vikt = {{ total_weight }}
- Valuta = {{ currency }}
- Kundens e-postadress = {{ customer.email }}
- Adressatens hela namn = {{ customer.name }}
- Adressatens förnamn = {{ customer.first_name }}
- Adressatens efternamn = {{ customer.last_name }}
- Betalleverantör = {{ gateway }}
- mm
För att få tillgång till orderns produkter så loopar man line_items
{% for line_item in line_items %} {{ line_item.sku }} {{ line_item.title }} {{ line_item.product.url }} {{ line_item.featured_image.src }} {% endfor %}
Några exempel på olika tjänsters kod:
gtag.js
<!-- gtag --> <script> gtag('event', 'purchase', { "transaction_id": "{{ name }}", "value": {{ line_items_price }}, "currency": "{{ currency }}", "tax": {{ tax_price }}, "shipping": {{ shipping_price }}, "items": [ {% for line_item in line_items %} { "id": "{{ line_item.sku }}", "name": "{{ line_item.title }}", "variant": "{{ line_item.variant_title }}", "list_position": {{ forloop.index }}, "quantity": {{ line_item.quantity }}, "price": "{{ line_item.price }}", "brand": "{{ line_item.vendor }}" }{% unless forloop.last %},{% endunless %} {% endfor %} ] }); </script>
Trustpilot, företagsomdömen och produktomdömen
<!-- truspilot --> <script> document.addEventListener('DOMContentLoaded', function() { const trustpilot_invitation = { recipientEmail: '{{ customer.email }}', recipientName: '{{ customer.first_name }}', referenceId: '{{ name }}', source: 'InvitationScript', productSkus: [{% for line_item in line_items %}'{{ line_item.sku }}'{% unless forloop.last %},{% endunless %}{% endfor %}], products: [ {% for line_item in line_items %} { sku: '{{ line_item.sku }}', productUrl: '{{ line_item.product.url }}', imageUrl: '{{ line_item.featured_image.src }}', name: '{{ line_item.title }}', }{% unless forloop.last %},{% endunless %} {% endfor %} }; tp('createInvitation', trustpilot_invitation); }); </script>