Hi,
I need some help implementing box quantity’s for the cart drawer (Increasing / decreasing the cart quantities in multiples). I used the input step for the product page which works fine but i tried the same for cart drawer, but when there is multiple items in the cart the step change doesn’t work.
I know I have to change something in cart.js but not sure where to start.
Thanks
Hello,
Please check and try the code
{% for item in cart.items %}
<input class=“quantity__input”
type=“number”
name=“updates”
value=“{{ item.quantity }}”
min=“{{ item.product.min_quantity }}”
step=“{{ item.product.min_quantity }}”
onkeydown=“return false”
aria-label=“{{ ‘cart.item.quantity.input_label’ | t: quantity: item.quantity, product: item.product.title | escape }}”
id=“cart-quantity-{{ item.key }}”
data-index=“{{ forloop.index0 }}”
{% endfor %}
Thanks
Thanks for your reply,
I tried the code and it seems to break my cart, im afraid. I should of explained slightly better, i need certain products to increment up in certain amounts, for example a product can only be sold in a box of 6, so the quantity needs to increase and decrease in 6’s. I’m using a metafield for the case qty number. here is my full code, however like i said previously the step count is being overridden by something in the cart.js file.
{% assign caseQty = item.product.metafields.custom.case_qty %}
{% if product.metafields.custom.case_qty == blank %}
{% assign caseQty = 1 %}
{% endif %}
@Ant_Papa
You have to create custom attribute at product level.
which will be accessible at cart page and perform same you did on product page.
Hope it helps…
Thanks for the reply, could you please elaborate on creating a create custom attribute at product level? Do you mean creating a custom metafield? or via code in cart.js?
Thanks
Hi @Ant_Papa ,
As per my understanding, you already have created the metafield, you just need to forward it to the cart page, and based on that you can filter the element.
Please refer to the below URL.
https://devsworks-1103.workctrl.store/
did you ever solve this, I have the exact same issue
thanks in advance