Hi, really hoping someone can help. I've amended my template to have the initial value on the products add to cart bar to be 0 this is due to a customisation I've got for adding multiple items at once. The problem I have now is that if you click the + icon it changes the value to 1 rather than the minimum amount (3). If you then add to cart it adds the minimum amount. Is there a way of getting the first step to jump to the minimum amount then the additional steps continue at 1
Hope I've explained it well enough
have you setup steps in the product?
Hi, yes the problem is I need the steps to be 1 as the minimum needs to be 3 but they can have 4, 5, 6 etc if I change step to 3 then they can only order 3, 6, 9 etc. I need the first step to be 3 for example and then revert to 1
OK I've managed to get the qty to change to the minimum value when clicking in the qty box by adding the following script:
<script>
function checkValue(sender, step)
{
var value = parseInt(sender.value);
if (value == '' || isNaN(value)) {
sender.value = step;
} else if (value < step) { sender.value = step; }
else if (value%step != 0 && value > step) {
sender.value = (value - (value%step));
} else {
return sender.value;
}
}
</script>
and then at the end of the qty input added the following onclick="<?php echo "checkValue(this, $product->min_order_level)"?>"
However I'm unsure how to continue this with the plus and minus buttons
then you set the step to 1
But then as the initial value is 0 when you click the plus the value goes to 1 not 3
in the script you wrote,
increment by the minimum if its not met, then by the step after that