Help who can…
To send order data to the Google Tag Manager I add the following script in the settings of the Checkout section:
{% if first_time_accessed %}> dataLayer.push({> event: “purchase”,> ecommerce: {> transaction_id: “{{ order.order_number || order.name }}”,> value: {{ total_price | times: 0.01 }},> tax: {{ tax_price | times: 0.01 }},> shipping: {{ shipping_price | times: 0.01 }},> currency: “{{ order.currency }}”,> discount: “???”,> items: [> {% for line_item in line_items %}{> item_id: “{{ line_item.product_id }}”,> discount: “???”,> item_name: “{{ line_item.variant.title || line_item.title }}”,> currency: “{{ order.currency || shop.currency }}”,> price: “{{ line_item.final_price | times: 0.01 }}”,> quantity: “{{ line_item.quantity }}”> },> > {% endfor %}> ]> }> });
Everything works well. Except I don’t know how to get coupon information (code). I need to send a discount code in the “discount” field.
Can you please suggest me the object and property. I couldn’t find it in the documentation. Tried experimenting with “discount_applications” but couldn’t get anything from it (I have no experience with with LiquidJS and how show object in console by it)