Skip to content

Instantly share code, notes, and snippets.

@nord
nord / shopify-bold-multi-currency-sufio-invoices.html
Last active November 13, 2020 10:32
Integration between Sufio and Bold Multi-Currency app to enable multi-currency support and create invoices in correct currencies. Read more at https://sufio.com/articles/shopify/create-invoices-from-orders/multiple-currencies/
<!-- Integration between Sufio and Bold Multi-Currency app to automatically create invoices in correct currencies. Used by Sufio for Shopify app (sufio.com/shopify). -->
<div class="invoice-currency-container" style="display:none;">
<span class=money id="currency-rate">1.00</span>
<input type="hidden" id="invoice-currency" name="attributes[Invoice Currency]" value="" />
<input type="hidden" id="invoice-currency-rate" name="attributes[Invoice Currency Rate]" value="" />
</div>
<script type="text/javascript">
updateInvoiceCurrency = function() {
$("input#invoice-currency").val(window.BOLDCURRENCY.currentCurrency);
$("input#invoice-currency-rate").val(window.BOLDCURRENCY.rateInfo[window.BOLDCURRENCY.currentCurrency].rate);
@nord
nord / shopify-customer-account-vat-examptions-validation.html
Last active April 24, 2018 13:14
Shopify customer account -- capture and validate VAT numbers and set business customers as tax exempt when applicable. Displays warning if VAT number is not valid. Used by Sufio for Shopify. https://sufio.com/articles/shopify/taxes/vat-eu-shopify/vat-exempt-eu/customer-account-page/
<!-- Shopify customer account -- capture and validate VAT numbers and set business customers as tax exempt when applicable. Displays warning if VAT number is not valid. Used by Sufio for Shopify (www.sufio.com/shopify). -->
<div class="vat-number-display">
{% if customer.metafields.sufio.vat_number %}
VAT Number: {{ customer.metafields.sufio.vat_number }}
<br />
<a href="#" class="vat-edit-link">Edit</a>
{% else %}
<a href="#" class="vat-edit-link">Add VAT number</a>
{% endif %}
</div>
@nord
nord / shopify-cart-abn-customer-fields.liquid
Created June 29, 2017 10:16
Shopify shopping cart -- use ABN numbers from Customer Fields app. Used by Sufio for Shopify app (www.sufio.com/shopify/invoice).
<!-- Shopify shopping cart -- use ABN numbers from Customer Fields app. Used by Sufio for Shopify app (www.sufio.com/shopify). -->
<div class="vat-reg-number">
<input type="hidden" id="vat_reg_no" name="attributes[VAT Registration Number]" value="{{ customer.metafields.customr.ABN }}">
</div>
@nord
nord / cart.liquid
Created April 27, 2017 06:38
Create invoices in EUR. Used by Sufio for Shopify (sufio.com/shopify). http://sufio.com/articles/shopify/create-invoices-from-orders/multiple-currencies/
<!-- Create invoices in EUR. Used by Sufio for Shopify (sufio.com/shopify). -->
<input type="hidden" name="attributes[Invoice Currency]" value="" />
<input type="hidden" name="attributes[Invoice Currency Rate]" value="" />
<script src="//cdn.shopify.com/s/javascripts/currencies.js" type="text/javascript"></script>
<script type="text/javascript">
var currency_code = 'EUR'; // Invoice Currency Code
var currency_rate = 1/Currency.rates[currency_code];
$('input[name="attributes[Invoice Currency]"]').val(currency_code);
$('input[name="attributes[Invoice Currency Rate]"]').val(currency_rate);
</script>
@nord
nord / shopify-customer-account-inac.html
Last active January 20, 2017 10:24
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",
@nord
nord / customer_order.html
Created November 10, 2016 13:12
Code snippet for adding a link to invoice to the Order page (customers/order.liquid) in Shopify. Used by Sufio for Shopify app (http://sufio.com/shopify).
<!-- Link to print or download invoice for order on the Customer Order page. Used by Sufio for Shopify (http://www.sufio.com/shopify). -->
<div class="invoice">
<a target="_blank" href="{{ shop.url }}/apps/sufio/invoice/?id={{ order.id }}&number={{ order.order_number }}">Invoice</a>
</div>
@nord
nord / shopify-customer-account-vat-exempt.html
Last active January 3, 2017 13:54
Code snippet for customers/account.liquid theme file to capture and validate VAT numbers on the customer account page and set business customers as tax exempt when applicable. Used by Sufio for Shopify app (www.sufio.com/shopify). Read more at http://sufio.com/articles/shopify/selling/vat-eu-customers-shopify/vat-exempt-eu/
<!-- Shopify customer account -- capture and validate VAT numbers and set business customers as tax exempt when applicable. Used by Sufio for Shopify (www.sufio.com/shopify). -->
<div class="vat-number-display">
{% if customer.metafields.sufio.vat_number %}
VAT Number: {{ customer.metafields.sufio.vat_number }}
<br />
<a href="#" class="vat-edit-link">Edit</a>
{% else %}
<a href="#" class="vat-edit-link">Add VAT number</a>
{% endif %}
</div>
@nord
nord / shopify-customer-account-disabled.liqud
Last active January 20, 2017 10:02
Shopify customer accounts - set disabled customers as VAT exempt. Used by Sufio for Shopify (www.sufio.com/shopify). Read more at https://sufio.com/articles/shopify/selling/vat-eu-customers-shopify/vat-exempt-eu/disabled-customers/
{% if customer.tags contains 'disabled' %}
<!-- Shopify customer account -- set disabled customer as VAT exempt. Used by Sufio for Shopify (www.sufio.com/shopify). -->
<script type="text/javascript">
$.ajax({
type : "GET",
dataType: "jsonp",
url: "/apps/sufio/customer-vat/",
data: { email: "{{ customer.email }}", force_tax_exempt: true }
});
</script>
@nord
nord / cart-currency-attributes.html
Created September 19, 2016 12:47
Create invoices in different currency and fetch the latest exchange rates. Used by Sufio for Shopify (sufio.com/shopify). http://sufio.com/articles/shopify/create-invoices-from-orders/multiple-currencies/
<!-- Created invoices in EUR. Used by Sufio for Shopify (sufio.com/shopify). -->
<input type="hidden" name="attributes[Invoice Currency]" value="" />
<input type="hidden" name="attributes[Invoice Currency Rate]" value="" />
@nord
nord / shopify-checkout-vat-exempt.html
Last active November 3, 2020 07:44
Code snippet for Shopify Plus checkout.liquid theme file to capture and validate VAT numbers and set business customers as tax exempt when applicable. Used by Sufio for Shopify app (www.sufio.com/shopify). Read more at http://sufio.com/articles/shopify/selling/vat-eu-customers-shopify/vat-exempt-eu/
<!-- Shopify checkout -- capture and validate VAT numbers and set business customers as tax exempt when applicable. Used by Sufio for Shopify (www.sufio.com/shopify). -->
<div class="additional-checkout-fields" style="display:none">
<div class="field field--optional field--vat-number">
<div class="field__input-wrapper">
<label class="field__label" for="checkout_vat_number">VAT number</label>
<input placeholder="VAT number" autocomplete="vat number" data-backup="checkout_vat_number" class="field__input" aria-labelledby="error-for-vat_number" size="30" type="text" name="checkout[vat_number]" id="checkout_vat_number">
</div>
</div>
</div>