I’m building a storage management system for one of my clients and I need to be able to subtract however many of a cms item that the client order. the flow would be something like this:
There are 12 of an item in storage. (the cms item has a numbers value of 12)
Client uses the form to order 6 of that item.
Form is submitted and 6 of that item is subtracted from the total.
Hopefully this explains my problem well enough since I unfortunately cannot share a cloneable.
I feel like there’s probably a pretty simple solution to this but I’m not very experienced with webflow logic and I cant find any tutorials on the issue.
I’ll be super happy for any help or suggestions, thanks a lot for reading this through!
Logic does not have any support for calculations that I’m aware of, so you cannot do a subtraction.
You could potentially get the current inventory value, calc the revised value, and push it back, but that’s risky. Concurrent purchase could compete and give you an artificially high inventory value.
You could use an external automation system like Make or Zapier, and it will support get/calc/update, but this won’t scale well for a realtime operation. If you hit the Webflow API’s rate limits ( 100/min I think? ), then requests will fail. Here you probably have at least 3 API calls per transaction… GET the item, calc the value, UPDATE the item, PUBLISH the item.
If the system needs to be robust, I would not store inventory values or anything that needs to be updated in realtime in the CMS. An actual database solution like Xano would be better for that.
This is a pretty small scale operation and I dont anticipate more than a couple requests per month, so that will most likely not be a problem
I feel like this could be a pretty good solution! I haven’t worked with make/zapier either so ill check it out! Do you know if I’ll be able to use the same form and CMS that I currently have or should I redo them in make/zapier?
Both the form and the CMS probably don’t need to change.
In Zapier, you’d trigger off of a new form submission, which would run soon after the form is submitted.