Dynamically Updating Cart Quantity Based on Field Value Change

I’m wanting the quantity of items currently in my Stripe Cart to update dynamically as I drag a slider so the end user can see the total price dynamically update as well. I do not want the user to have to decide on the quantity before adding the item to cart, so that isn’t an option.

I’m not savvy enough with JS to write my own advanced logic rule. I tried this based on the docs, but I’m erroring out:
if (
) {
(productId: prod_Q28mUFxb7OzQGO, quantity: {hours_coverage}, replace = true) => {[productId: ‘prod_Q28mUFxb7OzQGO’]: {hours_coverage}}

My form ID: ynIQSz and the step in question is called Hours/Shooter.

Thanks in advance for any help!

Hi @adam , I have taken a look at your form. Looks like you have removed a few input fields. The form steps are looking incomplete. Can you revert the package type step’s fields?

The value of feathery.fields[‘feathery.cart’].selectionsInclude(‘prod_Q28mUFxb7OzQGO’) is currently coming in as false, which means the code you have included inside if is skipped

Hey @kailash , I was playing around so I could grab snippets of code to use in other logic rules since I’m a JS novice. I’ve reverted it down to a single rule, but I’m sure I wrote the syntax wrong so it’s still erroring. I want it to do this:

When hours_coverage value changes, and if prod_Q28mUFxb7OzQGO (Lead Photographer NY) is in the feathery cart, then re-add the same product to the cart with an updated quantity=hours_coverage. This should allow me to use the slider alone to update the cart total price and the quantity of that product.

To get the product in the cart, one has to enter NY address at the start of the flow, then click “Photo” when asked is they want photo, video, or both.

Let me know if that makes sense!

Any thoughts on this?