Follow

Disable change gift quantity in cart page

If you don't want customer able to edit the quantity of your gifts product, you could follow those codes bellow. For example there are the code of showing your input box quantity inside cart.liquid file:

<input type="text" class="form-control" placeholder="{{ 88e00e5f7f3ef5f2d3610c49a5e88452 }}" name="updates[]" id="updates_{{ item.id }}" value="{{ item.quantity }}" />
<span class="input-group-btn">
<button class="btn btn-default" type="submit" id="update-cart" name="update"><i class="glyphicon glyphicon-ok"></i></button>
</span>

Copy and change it to like this (the code: {%if item.variant.metafields.secomapp.freegifts%} for checking this item is gift or not)

{%if item.variant.metafields.secomapp.freegifts%}
<input type="text" class="form-control" placeholder="{{ 88e00e5f7f3ef5f2d3610c49a5e88452 }}" name="updates[]" id="updates_{{ item.id }}" value="{{ item.quantity }}" readonly/>
<span class="input-group-btn">
<button class="btn btn-default" type="submit" id="update-cart" name="update" disabled><i class="glyphicon glyphicon-ok"></i></button>
</span>
{%else%}
<input type="text" class="form-control" placeholder="{{ 88e00e5f7f3ef5f2d3610c49a5e88452 }}" name="updates[]" id="updates_{{ item.id }}" value="{{ item.quantity }}" />
<span class="input-group-btn">
<button class="btn btn-default" type="submit" id="update-cart" name="update"><i class="glyphicon glyphicon-ok"></i></button>
</span>
{%endif%}

For replace the title of default gift product, for example: "Default Title (Freegift)" you could find the {{ item.title }} inside you cart.liquid file and replace by this code below:

{{ item.title | replace: ' / Default Title' | replace: 'Default Title' | replace: ' / Default', '' | replace: 'Default', '' }}

 
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk