#Add order to cart
If you've got awesome Shopify customers that return each month to buy the same thing you don't want to force them to have to re-add everything to cart each time. With some theme edits it's possible to add a feature that does just this - let's explore some very example Liquid and JavaScript code.
Relates to the blog post How to create a button to let customers repeat their previous order
To use, create a snippet called 'order-to-cart.liquid' and paste the content of the gist in. In order.liquid just add {% include 'order-to-cart' %}
wherever you like.
Now if you just want to use permalinks instead you could use this bit of magic instead:
<a href="/cart/{% for line_item in order.line_items %}{{ line_item.variant_id }}:{{ line_item.quantity }}{% unless forloop.last %},{% endunless %}{% endfor %}">Reorder this</a>
For anyone else who is using this. It works well, it just doesn't put the quantity in
Add this line in the json creator so that if they ordered more than 1 item it comes through
quantity: {{ line_item.quantity | json }},