Skip to content

Instantly share code, notes, and snippets.

@allenhurff
Created March 9, 2013 01:48
Show Gist options
  • Select an option

  • Save allenhurff/5122111 to your computer and use it in GitHub Desktop.

Select an option

Save allenhurff/5122111 to your computer and use it in GitHub Desktop.
FriendBuy Shopify App Widget - HTML & Javascript including the line items (sku, price, quantity).
<div id="friendbuy_widget"></div>
<script type="text/javascript">
var _frnd = {
site: "site-00000000-host",
order: {
id: "{{ order_number }}",
amount: "{{ total_price | money_without_currency }}"
},
products: [
{% for line in line_items %}
{
sku: "{{ line.sku }}",
price: "{{ line.line_price | money_without_currency }}",
quantity: "{{ line.quantity }}"
}
{% if forloop.rindex != 0 %},{% endif %}
{% endfor %}
]
};
(function(d, l, s) {
var a, b = d.getElementsByTagName(s)[0];
a = d.createElement(s);a.type = 'text/javascript';a.async = true;
a.src = l.protocol + '//djnf6e5yyirys.cloudfront.net/js/frndby.js';
b.parentNode.insertBefore(a, b);
})(document, location, 'script');
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment