localStorage.setItem not working in shopify checkout extension

dee29
Shopify Partner
5 0 0

How can i set value using localstorage.setItem in checkout ui extension?

Replies 2 (2)

vixnguyen
Shopify Partner
45 4 4

Hi,

Since Checkout UI extensions run in a Web Worker, so accessing localstorage is impossible.

vishwa-rzp
Shopify Partner
1 0 0

If you are using react, you can use the useStorage hook