The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Validate Shopping Cart on Submit Order

tim_schneider
Tera Contributor

I'm looking for a way we can validate the contents of a user's cart on submission... the background of it is a basic current stock level check that applies to certain requests. Currently we've got this checking when adding items to the cart but this has obvious downsides when multiple people fill up their carts at the same time (Which means either reserving it while it's in the cart, which isn't good as people leave carts stale all the time, or hoping nothing changes by checkout).

I've got the validation logic worked out, all I need to know is whether there's anywhere I can add a call to a function which has the ability to block the order.

Especially amazing would be anything that'll actually let me get into the sc_cart to sc_request conversion step & tweak the actual ordering logic - as we'd love to transfer more data from sc_cart to sc_request than the default does...

3 REPLIES 3

Brad Tilton
ServiceNow Employee
ServiceNow Employee

If you're on fuji or newer you can use catalog cart layouts. They allow you to use custom ui macros in the catalog, overriding the oob macros. In turn you could call your own custom javascript that performs your checks, then calls the oob cart functionality.



I don't have an actual example of this and it won't be the easiest thing in the world to configure.


Yeah we're on Fuji, but if there's a solution in a newer version I can put this on our backlog cause we should eventually be upgrading.



I considered this option & I know how to do it, but I was a little hesitant cause firstly it seems like a very fragile change for future patches & secondly I've found other ways to get a cart to submit without going via that screen (Any item that doesn't use the cart for example causes the rest of the cart to submit) so I was really hoping for a server-side solution.


I have similar requirement to validate date field within shopping cart and before the request is ordered.


Does any one has implemented this approach successfully.


we are in Geneva..