The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Enforcing quantity multiples in the cart


I am researching foxycart as a possible solution for our ecommerce site.

Many of our products must be ordered in multiples of the specified minimum quantity. For example, if we set quantity_min: 10 then the customer can only order in multiples of 10. Currently we enforce this with Javascript on the frontend and DB triggers on the backend. My question is...

Does foxycart have any built in functionality for enforcing rules that limit a customer to ordering only multiples of a predefined integer?

Thank you.
  • fc_adamfc_adam FoxyCart Team

    Thanks for posting - that's a great question. We don't currently natively support limiting an individual product's quantities to only being in specific multiples, but there is a way you could approach it. The quantity_min parameter we currently support only sets what the lowest threshold for a given product can be, but it can then be any quantity above that.

    You could approach it with Foxy by leaving the quantity as its normal set up, and have a custom product attribute that informs the customer what the amount of product is per bundle. If you were tracking inventory on your side, that would mean that you would need to do some calculations when handling the webhooks to work out the total quantity - but that would be fairly straight-forward.

    Going more custom - you could also customise the cart template to alter the quantity input - either changing it to a select input with option values set to multiples of 10, or a HTML5 "number" input, setting the "step" value to 10. The latter option would also probably require some javascript code to ensure it remains as a multiple of 10, and handle any instances where browser support isn't great.

    Could either of those approaches work? The first option would just make use of our native functionality, so would be quick and easy to get going - but it's whether that approach would be workable for your needs.
Sign In or Register to comment.