Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
integration:google_customer_reviews [2018/10/16 02:30] – [Adding Google Customer Reviews to your Foxy store] adamintegration:google_customer_reviews [2021/03/24 19:55] (current) adam
Line 59: Line 59:
           "opt_in_style": "CENTER_DIALOG",           "opt_in_style": "CENTER_DIALOG",
           {% if gtin|length > 0 %}           {% if gtin|length > 0 %}
-          "products": [{{ gtin|join(", ") }}]+          "products": [{{ gtin|join(", ")|raw }}]
           {% endif %}           {% endif %}
         });          }); 
Line 78: Line 78:
  
 You can [[https://support.google.com/merchants/answer/6219078?hl=en|use this page]] to find GTINs for your products. You can [[https://support.google.com/merchants/answer/6219078?hl=en|use this page]] to find GTINs for your products.
 +
 +==== Using product code instead of a custom product option for gtin ====
 +If you specify the ''gtin'' value as your product ''code'' already, you can use a modified version of the code to use the ''code'' you're passing.
 +
 +Specifically, replace this portion of the code:
 +
 +<code javascript>
 +{% set gtin = [] %}
 +{% for item in items %}
 +  {% for option in item.options %}
 +    {% if option.class == "gtin" %}
 +      {% set gtin = gtin|merge(['{"gtin":"' ~ option.value ~ '"}']) %}
 +    {% endif %}
 +  {% endfor %}
 +{% endfor %}
 +</code>
 +
 +With this version:
 +
 +<code javascript>
 +{% set gtin = [] %}
 +{% for item in items %}
 +  {% set gtin = gtin|merge(['{"gtin":"' ~ item.code ~ '"}']) %}
 +{% endfor %}
 +</code>

Site Tools