Skip to content

Instantly share code, notes, and snippets.

Quantity field:
After {{ item.variant.id }} and value="{{ item.quantity }}", add the following:
{% unless item.variant.inventory_management == blank or item.variant.inventory_policy == 'continue' %} max="{{ item.variant.inventory_quantity }}" {% endunless %}
At the end of cart.liquid, add
<script>
jQuery('[max]').change(function() {
{% if item.variant.compare_at_price and item.variant.compare_at_price > item.price %}
<del>{{ item.variant.compare_at_price | money }}</del>
{% endif %}
{{ item.price | money }}
.buyx-msg {
color: #F45B4F;
font-weight: bold;
font-size: 18px;
width: 100%;
text-align: center;
margin-bottom: 10px;
}
/*
.buyx-msg a {
Replace {{ item.title }}
with
{{ item.title
| remove: 'Default Title / ' | remove: ' - Default' | remove: ' / Default' | remove: 'Default' | remove: ' / Title' | remove: 'Title'
}}
For JavaScript cart popups:
title.replace(' - Default', '').replace(' / Default', '').replace('Default', '').replace(' / Title', '').replace('Title', '')
<div class="buyx-msg"></div>
{% include 'buyx-cart' %}