{% include 'variables' %}<section class="jumbotron jumbotron-primary"><div class="container text-center"><h3>A Javascript library to power your Shopify theme's cart.</h3><a href="{{ 'cartjs.zip' | asset_url }}" class="btn btn-lg btn-outline-inverse">Download Cart.js v{{ version }}</a></div></section><section class="jumbotron"><div class="container"><div class="row"><div class="col-md-8 col-md-offset-2"><h2>What is Cart.js?</h2><p>Cart.js is a very small open source Javascript library that makes the addition of powerful Ajax cart functionality to your Shopify theme a breeze.</p>
<p>It&#39;s designed to be simple to use, while providing some really powerful and nifty features, like:</p>
<ul>
<li><strong>Simple, consistent API</strong> for cart manipulation;</li>
<li><strong>Data API</strong> for markup-only use without needing to write a line of Javascript;</li>
<li><strong>DOM Binding</strong> to dynamically render HTML templates as your cart changes.</li>
</ul>
<p>You don&#39;t need to worry about ensuring your Ajax requests are synchronous, binding event listeners, or updating the DOM.</p>
</div></div><div class="row"><div class="col-md-10 col-md-offset-1"><div class="example example-live"><div class="well well-sm"><img src="{{ 'loader.gif' | asset_url }}" class="cart-visible-loading pull-right" width="16" height="11" alt="Loading..." />
You have
<strong data-cart-render="item_count"></strong>
items in your cart for a total of
<strong data-cart-render="total_price_money_with_currency"></strong>.
</div><div class="row"><div class="col-xs-4"><button data-cart-add="716934999" data-cart-quantity="1" class="btn btn-block btn-default"><span class="hidden-xs">Add </span><span class="visible-xs-inline">+</span>Hat</button></div><div class="col-xs-4"><button data-cart-add="716986707" data-cart-quantity="2" class="btn btn-block btn-default"><span class="hidden-xs">Add 2 </span><span class="visible-xs-inline">+</span>Coats</button></div><div class="col-xs-4"><button data-cart-clear="" class="btn btn-block btn-default">Clear<span class="hidden-xs"> Cart</span></button></div></div></div><div id="demo-simple-code" class="example-code collapse"><pre><code class="language-html">&lt;p&gt;
    You have
    &lt;strong data-cart-render=&quot;item_count&quot;&gt;&lt;/strong&gt;
    items in your cart for a total of
    &lt;strong data-cart-render=&quot;total_price_money_with_currency&quot;&gt;&lt;/strong&gt;.

    &lt;img src=&quot;loader.gif&quot; class=&quot;cart-visible-loading&quot; /&gt;
&lt;/p&gt;

&lt;button data-cart-add=&quot;716934999&quot; data-cart-quantity=&quot;1&quot;&gt;Add Hat&lt;/button&gt;
&lt;button data-cart-add=&quot;716986707&quot; data-cart-quantity=&quot;2&quot;&gt;Add 2 Coats&lt;/button&gt;
&lt;button data-cart-clear&gt;Clear&lt;/button&gt;
</code></pre>
</div><div class="example-footer"><a data-toggle="collapse" href="#demo-simple-code">Show markup for this example</a></div></div></div><div class="row"><div class="col-md-8 col-md-offset-2"><h2>Can it do more?</h2><p>Yes!
There&#39;s a whole lot more to Cart.js, from converting your existing product forms to Ajax with a single attribute to fully dynamic HTML template support.</p>
<p>And if you ever want to write your own Javascript directly, you can hook in to our custom events and API.</p>
<p>You can start learning about Cart.js with the <a href="/pages/guide">guide</a>, or check out the full <a href="/pages/reference">reference</a>.</p>
</div></div><div class="row"><div class="col-md-10 col-md-offset-1"><div class="example example-live"><div class="row"><div class="col-md-4"><form data-cart-submit="data-cart-submit"><div class="form-group"><label for="demo-advanced-id">Select a Product</label><select id="demo-advanced-id" name="id" class="form-control input-sm">{% for product in collections.frontpage.products %}<option value="{{ product.variants.first.id }}">{{ product.title }}</option>{% endfor %}</select></div><div class="form-group"><label for="demo-advanced-quantity">Choose a Quantity</label><select id="demo-advanced-quantity" name="quantity" class="form-control input-sm"><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option></select></div><div class="form-group"><label for="demo-advanced-custom-label">Add a Custom Label <small class="text-muted">(Optional)</small></label><input type="text" name="properties[Custom Label]" class="form-control input-sm"/></div><div class="form-group"><button type="submit" class="btn btn-default">Add to Cart</button></div></form></div><div class="col-md-8"><table data-cart-view="data-cart-view" class="table table-bordered table-condensed table-striped table-vertical-middle"><thead><tr><th>Item</th><th class="text-center">Price</th><th colspan="2" class="text-center">Qty</th><th class="text-right">Line Price</th></tr></thead><tbody><tr rv-each-item="cart.items"><td><strong rv-text="item.title"></strong><ul rv-hide="item.propertyArray | empty" class="list-unstyled"><li rv-each-property="item.propertyArray &lt; properties"><small class="text-muted">{property.name}: {property.value}</small></li></ul></td><td rv-html="item.price | money Currency.currentCurrency" class="text-center"></td><td class="text-center"><a href="#" rv-data-cart-update="index | plus 1" rv-data-cart-quantity="item.quantity | minus 1">&nbsp;-&nbsp;</a><span rv-text="item.quantity"></span><a href="#" rv-data-cart-update="index | plus 1" rv-data-cart-quantity="item.quantity | plus 1">&nbsp;+&nbsp;</a></td><td class="text-center"><a href="#" rv-data-cart-remove="index | plus 1" class="close">&times;</a></td><td rv-html="item.line_price | money Currency.currentCurrency" class="text-right"></td></tr><tr rv-show="cart.item_count | lt 1"><td colspan="5" class="text-center">You don't have any items in your cart.</td></tr></tbody><tfoot rv-show="cart.item_count | gt 0"><tr><td colspan="4" rv-html="cart.total_weight | weight_with_unit" class="text-muted small"></td><td rv-html="cart.total_price | money Currency.currentCurrency" class="text-right"></td></tr></tfoot></table><p class="text-center"><img src="{{ 'loader.gif' | asset_url }}" width="16" height="11" class="cart-visible-loading"/></p></div></div></div><div id="demo-advanced-code" class="example-code collapse"><pre><code class="language-html">&lt;!-- Add to cart form, using Data API --&gt;
&lt;form data-cart-submit=&quot;data-cart-submit&quot;&gt;
    &lt;label&gt;Select a Product&lt;/label&gt;
    &lt;select name=&quot;id&quot;&gt;
        &lt;option value=&quot;716986707&quot;&gt;Coat&lt;/option&gt;
        &lt;option value=&quot;716934999&quot;&gt;Hat&lt;/option&gt;
    &lt;/select&gt;

    &lt;label&gt;Choose a Quantity&lt;/label&gt;
    &lt;select name=&quot;quantity&quot;&gt;
        &lt;option&gt;1&lt;/option&gt;
        &lt;option&gt;2&lt;/option&gt;
        &lt;option&gt;3&lt;/option&gt;
        &lt;option&gt;4&lt;/option&gt;
        &lt;option&gt;5&lt;/option&gt;
    &lt;/select&gt;

    &lt;label&gt;Add a Custom Label &lt;small&gt;Optional&lt;/small&gt;&lt;/label&gt;
    &lt;input type=&quot;text&quot; name=&quot;properties[Custom Label]&quot; /&gt;

    &lt;button type=&quot;submit&quot;&gt;Add to Cart&lt;/button&gt;
&lt;/form&gt;

&lt;!-- Cart table, rendered using DOM Binding  --&gt;
&lt;table data-cart-view=&quot;data-cart-view&quot;&gt;
    &lt;thead&gt;
        &lt;tr&gt;
            &lt;th&gt;Item&lt;/th&gt;
            &lt;th&gt;Price&lt;/th&gt;
            &lt;th colspan=&quot;2&quot;&gt;Qty&lt;/th&gt;
            &lt;th&gt;Line Price&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr rv-each-item=&quot;cart.items&quot;&gt;
            &lt;td&gt;
                &lt;strong rv-text=&quot;item.title&quot;&gt;&lt;/strong&gt;
                &lt;ul rv-hide=&quot;item.propertyArray | empty&quot;&gt;
                    &lt;li rv-each-property=&quot;item.propertyArray &lt; properties&quot;&gt;
                        &lt;small class=&quot;text-muted&quot;&gt;{property.name}: {property.value}&lt;/small&gt;
                    &lt;/li&gt;
                &lt;/ul&gt;
            &lt;/td&gt;
            &lt;td rv-html=&quot;item.price | money Currency.currentCurrency&quot;&gt;&lt;/td&gt;
            &lt;td&gt;
                &lt;a href=&quot;#&quot; rv-data-cart-update=&quot;index | plus 1&quot; rv-data-cart-quantity=&quot;item.quantity | minus 1&quot;&gt;-&lt;/a&gt;
                &lt;span rv-text=&quot;item.quantity&quot;&gt;&lt;/span&gt;
                &lt;a href=&quot;#&quot; rv-data-cart-update=&quot;index | plus 1&quot; rv-data-cart-quantity=&quot;item.quantity | plus 1&quot;&gt;+&lt;/a&gt;
            &lt;/td&gt;
            &lt;td&gt;
                &lt;a href=&quot;#&quot; rv-data-cart-remove=&quot;index | plus 1&quot;&gt;&amp;times;&lt;/a&gt;
            &lt;/td&gt;
            &lt;td rv-html=&quot;item.line_price | money Currency.currentCurrency&quot;&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr rv-show=&quot;cart.item_count | lt 1&quot;&gt;
            &lt;td colspan=&quot;5&quot;&gt;You don&#39;t have any items in your cart.&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;tfoot rv-show=&quot;cart.item_count | gt 0&quot;&gt;
        &lt;tr&gt;
            &lt;td colspan=&quot;4&quot; rv-html=&quot;cart.total_weight | weight_with_unit&quot;&gt;&lt;/td&gt;
            &lt;td rv-html=&quot;cart.total_price | money Currency.currentCurrency&quot;&gt;&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tfoot&gt;
&lt;/table&gt;

&lt;img src=&quot;loader.gif&quot; width=&quot;16&quot; height=&quot;11&quot; class=&quot;cart-visible-loading&quot;/&gt;
</code></pre>
</div><div class="example-footer"><a data-toggle="collapse" href="#demo-advanced-code">Show markup for this example</a></div></div></div><div class="row"><div class="col-md-8 col-md-offset-2"><h2>Further Questions</h2><h3>Is it stable?</h3><p>Cart.js is one of the most widely used front end Shopify libraries. It&#39;s being
used in production by a vast number of Shopify stores, including our own
clients.</p>
<p>While it doesn&#39;t receive frequent updates, it is generally maintained and we do
make the effort to respond to bug reports and feature requests in a timely
manner.</p>
<p>If you&#39;re interested in using Cart.js, we&#39;ll be happy to answer any questions 
you have or help you get up and running.</p>
<h3>Who&#39;s using it?</h3><p>Aside from our own clients (some of whom are running very sizable Shopify
stores), a number of other sites are using Cart.js in the wild. Check out the
<a href="/pages/built-with-cart-js">Built with Cart.js</a> page for a list (don&#39;t forget to <a href="https://github.com/discolabs/cartjs/issues/new?title=New%20site%20for%20%22Built%20With%22%20Page:%20http://">add your own site</a>
once you&#39;ve built something using the library).</p>
<h3>What&#39;s the browser support like?</h3><p>Pretty good! Because the core Cart.js libraries use jQuery for Ajax requests
and DOM manipulation, the only limiting factor is the version of jQuery you
decide to use. This means that themes using a <code>1.x</code> version of jQuery with
Cart.js will be able to support IE6+, Chrome, Firefox, Safari 5.1+ and up.</p>
<p>If you&#39;re using the DOM binding functionality, there are some potential issues
with older browser that don&#39;t support the ES5 Javascript standard (in practice,
this means Internet Explorer 8 and below). See <a href="/pages/guide#getting-started-browser-support">Browser Support</a> in the Guide
for more detail.</p>
<h3>I have a bug report / feature request.</h3><p>Please add it to the <a href="https://github.com/discolabs/cartjs/issues">issues tracker</a> on GitHub.</p>
<h3>Can I contribute?</h3><p>Absolutely!
Just head to the <a href="https://github.com/discolabs/cartjs">GitHub</a> page, fork the repository and manage development 
through issues and pull requests.</p>
<p>If you&#39;re keen to help but don&#39;t know where to start, contact me
<a href="https://twitter.com/gavinballard">on Twitter</a>.</p>
<hr>
</div></div></div></section>