Skip to content

Instantly share code, notes, and snippets.

@nord
nord / bigcommerce-account-order-view-invoice.html
Last active July 26, 2016 10:24
HTML snippet for BigCommerce Panels/AccountOrder.html theme file to make the View Invoice button redirect users to invoices created by Sufio. Used by Sufio for BigCommerce app (www.sufio.com/bigcommerce).
<input type="button" class="btn" onclick="window.location='//sufio.com/bigcommerce/redirect/invoice/?shop='+encodeURIComponent('%%GLOBAL_ShopPathSSL%%')+'&id='+encodeURIComponent('%%GLOBAL_OrderId%%')+'&customer_id='+encodeURIComponent('%%GLOBAL_CurrentCustomerID%%')+'&email='+encodeURIComponent('%%GLOBAL_CurrentCustomerEmail%%')+'&amount='+encodeURIComponent('%%GLOBAL_OrderTotal%%')" value="%%LNG_ClickToPrintInvoice%%"/>
@nord
nord / shopify_cart_invoice_issue_date.html
Last active July 14, 2016 08:52
Shopify cart -- set custom issue date on invoices to the last day of month. Used by Sufio for Shopify (www.sufio.com/shopify).
<!-- Shopify shopping cart -- set custom issue date on invoices to the last day of month. Used by Sufio for Shopify (www.sufio.com/shopify). -->
<div class="invoice-issue-date">
<input type="hidden" id="invoice_issue_date" name="attributes[Invoice Issue Date]" value="">
</div>
<script type="text/javascript">
var nowDate = new Date();
var lastDate = new Date(nowDate.getFullYear(), nowDate.getMonth() + 1, 0);
var lastDateText = (lastDate.getFullYear() + '-' + (lastDate.getMonth() + 1) + '-' + lastDate.getDate());
$('input#invoice_issue_date').val(lastDateText);
</script>
@nord
nord / bigcommerce-customer-account-vat-exempt.html
Created June 28, 2016 13:00
HTML snippet for BigCommerce createacount_thanks.html theme file to validate VAT numbers from business customers and automatically set them as tax exempt when applicable. Used by Sufio for BigCommerce app (www.sufio.com/bigcommerce).
<!-- BigCommerce customer account -- set business customers as VAT exempt when applicable. Used by Sufio for BigCommerce (www.sufio.com/bigcommerce). -->
<script type="text/javascript">
$.ajax({
type : "GET",
dataType: "jsonp",
url: "//sufio.com/bigcommerce/customer-vat/",
data: { email: "%%GLOBAL_CurrentCustomerEmail%%", customer_id: "%%GLOBAL_CurrentCustomerID%%", shop: "%%GLOBAL_ShopPathSSL%%" }
});
</script>
@nord
nord / customer_account_orders_download.html
Last active March 5, 2016 02:47
Code snippet for adding "Download invoice" links to the Recent Orders table on the Customer Account page (customers/account.liquid) in Shopify. Used by Sufio for Shopify app (http://sufio.com/shopify).
<!-- Link to download invoice for order on the Customer Account page. Used by Sufio for Shopify (http://www.sufio.com/shopify). -->
<td>
<span class="invoice">
<a href="{{ shop.url }}/apps/sufio/invoice/download/?id={{ order.id }}&number={{ order.order_number }}">Invoice</a>
</span>
</td>
@nord
nord / customer_account_orders.html
Last active March 4, 2016 17:42
Code snippet for adding links to invoices to the Recent Orders table on the Customer Account page (customers/account.liquid) in Shopify. Used by Sufio for Shopify app (http://sufio.com/shopify).
<!-- Link to print or download invoice for order on the Customer Account page. Used by Sufio for Shopify (http://www.sufio.com/shopify). -->
<td>
<span class="invoice">
<a target="_blank" href="{{ shop.url }}/apps/sufio/invoice/?id={{ order.id }}&number={{ order.order_number }}">Invoice</a>
</span>
</td>
@nord
nord / sufio-multi-currency-integration.html
Last active March 4, 2016 17:58
Integration between Sufio and Shopify themes with multi-currency support. Read more at http://sufio.com/articles/shopify/create-invoices-from-orders/multiple-currencies/
<!-- Integration between Sufio and Shopify themes with multi-currency support. -->
<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($("span#currency-rate").attr("data-currency"));
$("input#invoice-currency-rate").val(Number($('span#currency-rate').text().replace(/[^0-9\.]+/g,"").replace(/^[^0-9]+/g,"").replace(/[^0-9]+$/g,"")));
@nord
nord / sufio-coin-integration.html
Last active March 4, 2016 17:57
Integration between Sufio and Coin apps to enable multi-currency support. Read more at http://sufio.com/articles/shopify/create-invoices-from-orders/multiple-currencies/
<!-- Integration between Sufio and Coin apps to enable multi-currency support. -->
<div class="invoice-currency-container" style="display:none;">
<input type="hidden" id="invoice-currency" name="attributes[Invoice Currency]" value="" />
<input type="hidden" id="invoice-currency-rate" name="attributes[Invoice Currency Rate]" value="" />
<input type="hidden" id="invoice-usd-rate" name="attributes[Invoice USD Rate]" value="" />
</div>
<script type="text/javascript">
$( document ).on( "shoppad:coin:currencychange", function() {
$("input#invoice-currency").val(window.Shoppad.apps.coin.getLocalCurrency());
$("input#invoice-currency-rate").val(window.Shoppad.apps.coin.getLocalCurrencyUSDExchangeRate() / window.Shoppad.apps.coin.getBaseCurrencyUSDExchangeRate());
@nord
nord / shopify-cart-abn.html
Last active March 4, 2016 17:59
HTML snippet for Shopify cart.liquid theme file to capture ABN from customers. Used by Sufio for Shopify app (www.sufio.com/shopify). Read more at http://sufio.com/articles/shopify/create-invoices-from-orders/business-customers/include-customer-abn/
<!-- Shopify shopping cart -- capture ABN from customers. Used by Sufio for Shopify app (www.sufio.com/shopify). -->
<div class="vat-reg-number">
<label for="vat_reg_no">ABN</label>
<input type="text" id="vat_reg_no" name="attributes[VAT Registration Number]" value="{{ cart.attributes['VAT Registration Number'] }}">
</div>
@nord
nord / gist:3e6dc75d8e849a687dde
Last active August 29, 2015 14:17
Code snippet for adding links to invoices to customer account pages (customers/account.luquid) and order details pages (customers/order.liquid) in Shopify. Used by Sufio for Shopify app (http://sufio.com/shopify).
<!-- Link to print or download invoice from customer account page. Used by Sufio for Shopify (http://www.sufio.com/shopify). -->
<div class="order-invoice">
<a target="_blank" href="{{ shop.url }}/apps/sufio/invoice/?id={{ order.id }}&number={{ order.order_number }}">Print or download invoice</a>
</div>
@nord
nord / thank_you.html
Last active August 29, 2015 14:10
Code snippet for adding links to invoices to the "Thank You" page of the checkout in Shopify. Used by Sufio for Shopify app (http://sufio.com/shopify).
<!-- Link to print or download invoice for current order. Used by Sufio for Shopify (http://www.sufio.com/shopify). -->
<div class="order-invoice">
<i class="icon icon--print"></i>
<a target="_blank" href="{{ shop.url }}/apps/sufio/invoice/?id={{ order.id }}&number={{ order.order_number }}">Print or download invoice for this order</a>
</div>