How to dynamcially reset all stepper values


I want to reset all stepper values dynamically if a user moves away from cart and comes back to it for new order. I have following code that I am using to check if it is a new order and trying to reset stepper values with a loop. But after first loop it seems code breaks and 2nd loop never happens. Is this the best way to reset stepper values?

if ( {
console.log(‘’ +; {
console.log(‘Reseting stepper value - #item-’;
var instance = app.stepper.setValue($(’#item-’’.stepper’), ‘0’);
}); = 0; = ‘’; = []; = 0;

If I comment
var instance = app.stepper.setValue($(’#item-’’.stepper’), ‘0’);

I can see full loop console debug.

Hace you tried with ’ ’ without the Zero.
Ir 0 without the ’ '.
Didn’t try, just a suggestion.

  1. Define stepper’s id where ‘stepper-init’ class is
  2. Then,
    var instance = app.stepper.setValue(’#item’,‘yourNewValue’);
  3. OR,
    Var instance = app.stepper.get(‘el’);
    Good luck !!!

Tried both ways, no luck

Thanks for reply.

Added id to stepper it seems it resets one stepper in loop but then stops.

var instance = app.stepper.setValue(’#stepper-’, 0);

<div id="stepper-{{id}}" class="stepper stepper-raised stepper-fill cart_stepper" data-id="{{id}}" data-sku="{{sku}}" data-price="{{price}}" data-qtypp="{{qtypp}}" data-value="0" data-min="0" data-max="100" data-step="1">' +
                                    '<div class="stepper-button-minus"></div>' +
                                    '<div class="stepper-value"></div>' +
                                    '<div class="stepper-button-plus"></div>' +
                                '</div>' +