We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7aaa305 commit d0a241aCopy full SHA for d0a241a
utils/context/AppContext.js
@@ -11,11 +11,12 @@ export const AppProvider = ({ children }) => {
11
12
useEffect(() => {
13
// Check if we are client-side before we access the localStorage
14
- if (process.browser) {
15
- let cartData = localStorage.getItem('woocommerce-cart');
16
- cartData = null !== cartData ? JSON.parse(cartData) : '';
17
- setCart(cartData);
+ if (!process.browser) {
+ return;
18
}
+ let cartData = localStorage.getItem('woocommerce-cart');
+ cartData = null !== cartData ? JSON.parse(cartData) : '';
19
+ setCart(cartData);
20
}, []);
21
22
return (
0 commit comments