Last active
January 20, 2017 10:24
-
-
Save nord/64c39beddaa73918b04fbd2269299924 to your computer and use it in GitHub Desktop.
Shopify customer accounts - set INAC registered customers (Status Indian in Canada) as tax (GST) exempt. Used by Sufio for Shopify (www.sufio.com/shopify).
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 customer.tags contains 'INAC' %} | |
<!-- Shopify customer account -- set INAC registered customers (Status Indian in Canada) as tax (GST) exempt. Used by Sufio for Shopify (www.sufio.com/shopify). --> | |
<script type="text/javascript"> | |
function getCookieValue(a) { var b = document.cookie.match('(^|;)\\s*' + a + '\\s*=\\s*([^;]+)'); return b ? b.pop() : ''; } | |
var email = "{{ customer.email }}"; | |
if (getCookieValue("sufio_vat_email_inac") != email) { | |
document.cookie = "sufio_vat_email_inac="+email+";expires=Tue, 31 Dec 2030 00:00:00 GMT;path=/"; | |
$.ajax({ | |
type : "GET", | |
dataType: "jsonp", | |
url: "/apps/sufio/customer-vat/", | |
data: { email: "{{ customer.email }}", force_tax_exempt: true } | |
}); | |
}; | |
</script> | |
{% endif %} |
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
<!-- Shopify customer registration -- capture INAC numbers from customers. Used by Sufio for Shopify (www.sufio.com/shopify). --> | |
<label for="inac_no" class="label--hidden">INAC Number</label> | |
<input id="inac_no" type="text" name="customer[note][INAC Number]" placeholder="INAC Number" /> | |
<input type="hidden" name="customer[tags]" id="customer_tags" value="" /> | |
<script type="text/javascript"> | |
$("#inac_no").change( function() { | |
// Tag customer as INAC if INAC Number was provided | |
// This part can be updated to allow some basic INAC number validation | |
$("#customer_tags").val($("#inac_no").val() ? "INAC" : ""); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment