Skip to content

Instantly share code, notes, and snippets.

@nord
Last active January 20, 2017 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nord/64c39beddaa73918b04fbd2269299924 to your computer and use it in GitHub Desktop.
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).
{% 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 %}
<!-- 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