Does anyone know of there’s a clear path to extend...
# suitecommerce
k
Does anyone know of there’s a clear path to extending Add To Cart validation?
s
If you're using SCA then you can, in the core code, extend the model's validation object.
Outside of that, you would need to bind a callback to the Cart's
beforeAddLine
event
Oh and don't forget that for some things, like custom fields, you can add validation to the backend as well
And you probably want to duplicate your validation rules on the
beforeSubmit
event, just in case an item was added to the cart that circumvented your
beforeAddLine
validation. In extreme cases, you may also want to replicate it in backend SuiteScripts as well (ie, if it's very important that some rules are applied)
👍 1
k
This is the route we’re now considering
I initially thought that product model validation would impact the ability to add to cart, but it seems there are additional validations in the add to cart button view that are independent from a model.