what are the GTIN liquid variables?

Highlighted

Hello,

Need to implement Google Reviews checkout script. I have found most of the variables for this. For example:  "order_id": "ORDER_ID" becomes  "order_id": "{{order.order_number}}"

 

But I cannot find the liquid variables for each GTIN of product(s) purchased. This:

 

"products": [{"gtin":"GTIN1"}, {"gtin":"GTIN2"}]

 

If anyone knows what to replace GTIN1 and GTIN2 with please let me know.

 

thank you!

0 Likes
Highlighted

For anyone else looking to do this the code would be something like:

This uses a 7 day delay and that can be changed using the assign (just change the number 7 to whatever you need)

Gtin is line item variant barcode

<!-- START  -->
{% assign seconds = 7 | times: 24 | times: 60 | times: 60 %}
<script src="https://apis.google.com/js/platform.js?onload=renderOptIn"
 async defer>
</script>
 
<script>
 window.renderOptIn = function() {
   window.gapi.load('surveyoptin', function() {
     window.gapi.surveyoptin.render(
       {
         "merchant_id": "xxxxxxxxx",
         "order_id": "{{ order.id }}",
         "email": "{{ customer.email }}",
         "delivery_country": "NO",
         "estimated_delivery_date": "{{ "now" | date: "%s" | plus: seconds | date: "%Y-%m-%d" }}",
         "products": [{% for line_item in line_items %}{"gtin":"{{ line_item.variant.barcode }}"},{% endfor %}], 
         "opt_in_style": "CENTRE_DIALOG"
       });
    });
 }
</script>
 <!-- BEGIN GCR Language Code -->
<script>
 window.___gcfg = {
   lang: 'no'
 };
</script>
<!-- END -->

 

★★★ Need help setting up your Shopify store? Hire me here: https://liquify.design ★★
0 Likes