Austin Troth
Posts: 0
Joined: Wed Feb 26, 2014 4:54 am

Removing item from storage array (shopping cart example)

In the shopping cart tutorial, see link to tutorial below, I want to add a function to remove a specific item from the shopping cart. What set of commands would you use to do this, similar to the add to shopping cart. I am fairly new to appery and coding so please keep it simple. Thanks!
https://devcenter.appery.io/tutorials...

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Removing item from storage array (shopping cart example)

Hello Austin,

Please use method splice() for that: https://developer.mozilla.org/en/docs...

e.g.:

prevar myArr = Apperyio.storage.myArr.get();
myArr = myArr.splice(1, 0);
Apperyio.storage.myArr.set(myArr);/pre
here myArr - name of your array

Austin Troth
Posts: 0
Joined: Wed Feb 26, 2014 4:54 am

Removing item from storage array (shopping cart example)

Awesome, worked great. Thanks

Jason Schmidt
Posts: 0
Joined: Tue Jul 25, 2017 7:07 pm

Removing item from storage array (shopping cart example)

Sorry for the bump, but I got this to work, but it clears the entire cart, not the specific item you click

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Removing item from storage array (shopping cart example)

It removes the first item from the variable "myArr". If you want to remove specific item - please set it's item as a parameter of the method "splice": https://developer.mozilla.org/en/docs...

Return to “Issues”