Just re-read your question. There is also another way: you could write a small function on the checkbox.onChange event. In that function, you could write an IF-statement like “IF NOT checkbox.checked THEN quantity.value = 0” (This is pseudo code!).
THen the user immediately sees that this happens before submitting.