SmartSize script is not running in my theme

SmartSize script is not running in my theme

In rare cases, the app script may not be running in your theme. To resolve this issue, please follow these steps:

First click on "Edit code" in the dropdown to open the code editor for your theme:




There are 2 things to add to your theme:


First, on the left hand side, scroll to Snippet section and add a new snippet. 





Name it smartSize.liquid



Next, inside the file, copy the following content:

‚Äč
<script>
window.sizefox = window.sizefox === undefined ? {} : window.sizefox;
sizefox.shop = "{{ shop.permanent_domain }}";
{% assign t = template | prepend: '/' | append: '.' %}
{% if t contains '/product.' %}
sizefox.data = {
  collections: "{{ product.collections | map: 'id' | join: ',' }}",
  tags: {{ product.tags | join: ',' | json }},
  product: "{{ product.id }}",
  productname: "{{ product.title | replace: '"', '"' }}",
  type: {{ product.type | json }}
};
{% endif %}
fetch(https://server.smartsize.io/sizepopupversion?shopname= + sizefox.shop)
.then (response => response.json())
.then(json => {console.log("Using SmartSize popup version: ", json)

scripturl = json.url;
  const smartScript = document.getElementById("smartsizeScript");
  smartScript.src = scripturl
});
</script>


Then click save. You should have a file that looks like this (see below). Make sure that you SAVE it.









    • Related Articles

    • How do I manually install SmartSize script on my theme?

      Currently, SmartSize can programmatically install the necessary code to published themes. However, if you want to test on an unpublished theme and can not afford to turn it publish temporarily, you can follow this guide. First click on "Edit code" in ...
    • Find products missing a size chart

      To find out which products miss a size chart: Open SmartSize Click on 'Edit' in ANY size chart. Click on 'Link to Products' Click the Products dropdown The Product dropdown displays all the products in your catalogue. Products display a green chip ...