Created
March 18, 2017 05:07
-
-
Save zakhardage/cd87e33fae427793032fbed95d1fe3af to your computer and use it in GitHub Desktop.
cart using wholesale discount
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% if customer %}{% assign tags = customer.tags | join:' ' | downcase %}{% if tags contains 'wholesale' %}{% assign wholesale = true %}{% endif %}{% endif %} | |
| {% if wholesale %} | |
| {% if tags contains 'reorder' or customer.orders_count > 0 %}{% assign reorder = true %}{% endif %} | |
| {% assign min = settings.cart-min | times:100 | minus:1 %} | |
| {% if reorder %}{% assign min = setting.cart-min-reorder | times:100 | minus:1 %}{% endif %} | |
| {% endif %} | |
| <div class="meta grid"> | |
| {% if wholesale %}{% assign total = cart.total_price | divided_by:2 %}{% else %}{% assign total = cart.total_price %}{% endif %} | |
| <p>{{ total | money | remove:' ' }}</p> | |
| <h1>Cart: {{ cart.items.size }} {{ cart.items.size | pluralize:'item','items' }}</h1> | |
| </div> <!-- end .meta --> | |
| <form action="/cart{% if wholesale and cart.total_price > min %}?discount={{ settings.discount-code }}{% endif %}" method="post" id="cartform"> | |
| <table> | |
| {% for item in cart.items %} | |
| <tr> | |
| <td class="desktop remove"><a href="/cart/change?line={{ forloop.index }}&quantity=0"><i class="fa fa-times" aria-hidden="true"></i></a></td> | |
| <td class="desktop"><a href="{{ item.product.url }}">{{ item.product.images.first | product_img_url:'compact' | img_tag:item.title }}</a></td> | |
| <td> | |
| <a href="{{ item.product.url }}">{{ item.title }}</a> | |
| <p class="mobile mobile-remove"><br /><a href="/cart/change?line={{ forloop.index }}&quantity=0"><i class="fa fa-times" aria-hidden="true"></i> remove</a></p> | |
| </td> | |
| {% if wholesale %}{% assign price = item.price | divided_by:2 %}{% else %}{% assign price = item.price %}{% endif %} | |
| <td class="desktop-600">{{ price | money | remove:' ' }}</td> | |
| <td> | |
| <div class="qty grid"> | |
| <span class="minus desktop-600" data="{{ forloop.index }}">-</span> | |
| <input class="qty-{{ forloop.index }}" type="text" name="updates[{{ item.variant.id }}]" id="updates_{{ item.variant.id }}" value="{{ item.quantity }}" /> | |
| <span class="plus desktop-600" data="{{ forloop.index }}">+</span> | |
| </div> <!-- end .qty --> | |
| </td> | |
| {% if wholesale %}{% assign line-price = item.line_price | divided_by:2 %}{% else %}{% assign line-price = item.line_price %}{% endif %} | |
| <td>{{ line-price | money | remove:' ' }}</td> | |
| </tr> | |
| {% endfor %} | |
| </table> | |
| {% if wholesale %} | |
| {% unless total > min %} | |
| <div class="rte"><p>Your order does not meet our minimum wholesale order</p></div> | |
| {% endunless %} | |
| {% endif %} | |
| <div class="summary grid"> | |
| <div class="left"> | |
| <a href="/collections/all" class="btn"><i class="fa fa-angle-left" aria-hidden="true"></i> Back to shopping</a> | |
| <button type="submit" name="update"><i class="fa fa-refresh" aria-hidden="true"></i> Update cart</button> | |
| </div> <!-- end .left --> | |
| <div class="right"> | |
| {% if wholesale %} | |
| {% if total > min %} | |
| <button type="submit" name="checkout">Checkout</button> | |
| {% endif %} | |
| {% else %} | |
| <button type="submit" name="checkout">Checkout</button> | |
| {% endif %} | |
| </div> <!-- end .right --> | |
| </div> <!-- end .summary --> | |
| </form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment