Hey all, is there a way to set the max item quanti...
# suitecommerce
t
Hey all, is there a way to set the max item quantity a user can order dynamically? I have a Suitelet which does some calculations with incoming future POs and should also count their remaining free quantity as available in the shop. Backorders are allowed but i want to limit this quantity. Now I've got a SuiteScript2 Service which does a XHR call and loads the right number. But this only changes the displayed quantity, not the validated. So I was experimenting with an extension to extend the Configuration.ItemKeyMapping.Site module, successfully setting _stock to something fix for example. But here I can't load this Suitelet to get the data since it's not waiting for the callback. Now i'm "stuck" at this idea on how to load max quantity and apply it to the item on the fly... Any ideas or suggestions? Or even a whole new path to solve this? - Thanks for any feedback!
s
Stepping back, enforcing validation at add-to-cart and order submit is a pretty standard customisation. I'm not exactly sure how your Suitelet is meant to work but it seems like calling it asynchronously after the page has loaded and then binding a call to its data via a validation event such as
beforeAddLine
,
beforeUpdateLine
,
beforeSubmit
, etc should be easy enough. It sounds like the tough thing here is manipulating how a core module works to change the available quantity to a more desirable (but entirely artificial) number? Is that right?
If so, my suggestion would be to ignore the core module and simply add a secondary customisation that hides/removes the existing stock availability information and then shows the artificial number instead.