Simple Percentage Discount input - how to do it in Rails 7 - should I use stimulus js?

nikos83 nikos83 posted on 2023-05-18 21:06:32 UTC

Hi,
I'm using newest Rails 7 and in my app I have implemented cart with turbo similar to the from Episode, I would like to add some new feature to the checkout show little input field where I can input some discount in percentage for example 20, then my total price should be discounted by 20%.

I wonder how would  you implement this functionality ? Should I use simple js script and get id of elements then change it? Or use Stimulus JS - I don't really know this framework ?
Any advice are welcome!
Thanks  

Login to Comment
Back to forums