Last active
August 29, 2015 14:27
-
-
Save jnowland/d1619d14c1d6e56e5a75 to your computer and use it in GitHub Desktop.
Credit Card Gist
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
<select name="CardExpiryYear"> | |
{% assign yearIncreament = globals.site.dateNow | date: "yyyy" -%} | |
{% for i in (0..10) -%} | |
{% capture yearIncreament -%}{{ yearIncreament | plus: 1}}{% endcapture -%} | |
<option value="{{ yearIncreament }}">{{ yearIncreament }}</option> | |
{% endfor -%} | |
</select> |
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 -%} You really dont need to capture {% endcomment -%} | |
<select name="CardExpiryYear"> | |
{% for i in (0..10) -%} | |
<option value="{{ globals.site.dateNow | date: "yyyy" | plus: forloop.index0 }}"> | |
{{ globals.site.dateNow | date: "yyyy" | plus: forloop.index0 }} | |
</option> | |
{% endfor -%} | |
</select> |
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
<script> | |
{% for myProduct in myProductData.items -%} | |
ga('ec:addProduct', { | |
'id': {{ myProduct.product.productCode }}', | |
'name': {{ myProduct.product.name | remove "'" }}', | |
'category' : '', | |
'brand' : '', | |
'variant' : '{{ myProduct.description | remove "'" }}', | |
'price' : '{{ myProduct.unitPrice }}', | |
'quantity' : '{{ myProduct.units }}', | |
}); | |
ga('ec:setAction', 'purchase', { | |
'id': '{{ myProduct.invoiceNumber }}', | |
'affiliation': '', | |
'revenue': '{{ myProduct.totalPrice }}', | |
'tax': '', | |
'shipping': '{{ myProduct.shippingPrice }}', | |
'coupon': '{{ myProduct.discountCodeId }}', | |
}); | |
{% endfor -%} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment