Storage
INFO
📙 What you'll learn
Basic usage
Store new value
salla.storage.set()
can be used to store a name value in the browser's local storage. In the following example, a key named user
has been stored with the value Ahmed
.
Get stored value
salla.store.get()
can be used to retrieve the value of the stored key user
from the browser's local storage.
Remove stored value
salla.store.remove()
can be used to remove the value of the stored key user
from the browser's local storage.
Clear all keys
salla.storage.clearALL()
can be used to remove any stored key/value from the browser's local storage.
Loop over all stored values
Handling user's token
object
.
Handling a user's cart summary
total
: grand total for the cart.sub_total
: cart sub total, which is the items total without any extra cost, such as shipping cost.discount
: any given discount.real_shipping_cost
: The real cost of shipping.count
: the number of the items in the cart.shipping_cost
: the total cost of the shipping. The method
salla.storage.set()
is used to create a cart.summery
in the local storage as follows:
salla.storage.get()
is used to return the user's cat summary from the local storage as follows: