Hi,
I think the best is to create a view override for product / quantity via the menu Display>Views and change the line:
$attributes = ' class="' . $css_button . ' ' . $css_button_cart. '" onclick="if(window.hikashop.addToCart) { return window.hikashop.addToCart(this); }" data-addToCart="'.$this->row->product_id.'" data-addTo-div="hikashop_product_form" data-addTo-class="add_in_progress"';
In the onclick attribute, you can add a call to your javascript function in order to check that the correct number of products is selected and only call window.hikashop.addToCart if that's the case.