Closed moxiemonkshood closed 5 years ago
Is this in the context of a node app? Or the web?
This is on the web.
SEAN BRADLEY [ Senior Technical Lead ] — EMAIL: sean.bradley@moxiesozo.com mailto:sean.bradley@moxiesozo.com —
MOXIE SOZO — ADDRESS: 1140 Pearl Street | 2nd Floor | Boulder | CO | 80302 MAIN: 720.304.7210 WEB: www.moxiesozo.com http://www.moxiesozo.com/ —
On Nov 16, 2016, at 9:24 AM, Mina Smart notifications@github.com wrote:
Is this in the context of a node app? Or the web?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Shopify/js-buy-sdk/issues/271#issuecomment-260992825, or mute the thread https://github.com/notifications/unsubscribe-auth/AL-6vjFcxu3YAWDZXqSJPrLaXZ6bKuFnks5q-y4ugaJpZM4Kz9eo.
@moxiemonkshood do you know what browser + version localStorage
did not exist on? Did you have to polyfill in localStorage
in your above example?
Mac Google Chrome Version 54.0.2840.98 (64-bit) Windows IE 11.103.10586.0 It isn’t that the localStorage didn’t exist. I was actually using it in my script. It was that the sdk wasn’t creating a cart in localStorage. I looked into it, and it was checking for localStorage on globalVars and always returning false. After adding globalVars.set( ‘localStorage’ , localStorage ) , it started saving the cart successfully again. Thanks
\
SEAN BRADLEY [ Senior Technical Lead ] — EMAIL: sean.bradley@moxiesozo.com mailto:sean.bradley@moxiesozo.com —
MOXIE SOZO — ADDRESS: 1140 Pearl Street | 2nd Floor | Boulder | CO | 80302 MAIN: 720.304.7210 WEB: www.moxiesozo.com http://www.moxiesozo.com/ —
On Nov 16, 2016, at 12:08 PM, Mikko Haapoja notifications@github.com wrote:
@moxiemonkshood https://github.com/moxiemonkshood do you know what browser + version localStorage did not exist on?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Shopify/js-buy-sdk/issues/271#issuecomment-261040858, or mute the thread https://github.com/notifications/unsubscribe-auth/AL-6vmzIZpLvqZGQjuQCNDCjmz-W67Kmks5q-1SXgaJpZM4Kz9eo.
@moxiemonkshood how are you consuming js-buy-sdk
is it from npm
or from this url http://sdks.shopifycdn.com/js-buy-sdk/v0/latest/shopify-buy.umd.polyfilled.min.js ? Are you bundling your code via some other build tool rollup
, browserify
, webpack
, etc?
Thanks for being so helpful I'm looking into this issue.
Glad to contribute
That is what I originally linked to.Though now the line where localStorage is being checked is a bit different than on the version that I have, and I don’t see the globalVars object in there.
I saved the source to debug last night and ended up with the script below.
Thanks.
SEAN BRADLEY [ Senior Technical Lead ] — EMAIL: sean.bradley@moxiesozo.com mailto:sean.bradley@moxiesozo.com —
MOXIE SOZO — ADDRESS: 1140 Pearl Street | 2nd Floor | Boulder | CO | 80302 MAIN: 720.304.7210 WEB: www.moxiesozo.com http://www.moxiesozo.com/ —
On Nov 16, 2016, at 1:13 PM, Mikko Haapoja notifications@github.com wrote:
@moxiemonkshood https://github.com/moxiemonkshood how are you consuming js-buy-sdk is it from npm or from this url http://sdks.shopifycdn.com/js-buy-sdk/v0/latest/shopify-buy.umd.polyfilled.min.js http://sdks.shopifycdn.com/js-buy-sdk/v0/latest/shopify-buy.umd.polyfilled.min.js ?
Thanks for being so helpful I'm looking into this issue.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Shopify/js-buy-sdk/issues/271#issuecomment-261058390, or mute the thread https://github.com/notifications/unsubscribe-auth/AL-6vvzs9qhyNDE7SnVEjCPLM4bUirleks5q-2P7gaJpZM4Kz9eo.
In checking for localStorageAvailable , it seems that we are checking for something that hasn't ever been set.
To get local storage to work, I set localStorage on the globalVars object then it was able to succesfully check for it.
Found the source in polyfills.js
Thanks!