This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{%- if template =='cart' or template contains 'product' -%} | |
<script>(function(r,e,o){ | |
var w=window,d=document,t,s,x; | |
w.tfcapi=t=w.tfcapi||function(){t.q=t.q||[]; t.q.push(arguments);}; | |
t('init', {storeKey: r, environment: e, ...o}); | |
x=d.getElementsByTagName('script')[0]; | |
s=d.createElement('script'); | |
s.type='text/javascript';s.async=true; | |
s.src='https://'+r+'-cdn'+(e==='dev'||e==='staging'?'.'+e:'')+ '.truefitcorp.com/fitrec/'+r+'/js/tf-integration.js'; | |
x.parentNode.insertBefore(s,x); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function caProvinceCodesToNames(stateCode) { | |
const code = stateCode.toLowerCase(); | |
if (code === "ab") { | |
return "Alberta" | |
} else if (code === "bc") { | |
return "British Columbia" | |
} else if (code === "mb") { | |
return "Manitoba" | |
} else if (code === "nb") { | |
return "New Brunswick" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple function to convert US 2-letter state codes to capitalised state names | |
function usStateCodesToNames(stateCode) { | |
const code = stateCode.toLowerCase(); | |
if (code === "al") { | |
return "Alabama" | |
} else if (code === "ak") { | |
return "Alaska" | |
} else if (code === "az") { | |
return "Arizona" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for opt in product.options_with_values %} | |
{% if opt.name == 'Size' %} | |
{% for var in product.variants %} | |
{% if var.available %} | |
{% assign spanclass='size-label'%} | |
{% else %} | |
{% assign spanclass='size-label size-sold'%} | |
{% endif %} | |
{% if opt.values contains var.option1 %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% comment %}Print 'colour' variable to show variant loop is working{% endcomment %} | |
<p><strong>{{ colour }}</strong></p> | |
{% for product_option in product.options_with_values %} | |
{% if product_option.name == 'Colour' %} | |
{% if product_option.values contains colour %} | |
{% assign proceed = true %} | |
{% comment %}Print confirmation that test has passed{% endcomment %} | |
<p>Yep</p> |