Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

cookiesEnabled function not present in the most recent version of theme-scripts/cart.js #112

Open
isaac-martin opened this issue Oct 3, 2018 · 5 comments
Labels

Comments

@isaac-martin
Copy link
Contributor

Sorry for crosspost - not sure if it belonged here or in the theme-scripts repo
Shopify starter and Slate have a function that looks like the below.

import {cookiesEnabled} from '@shopify/theme-cart';

// Apply a specific class to the html element for browser support of cookies.
if (cookiesEnabled()) {
  document.documentElement.className = document.documentElement.className.replace('supports-no-cookies', 'supports-cookies');
}

However the latest version of theme scripts / cart doesn't have that function cookiesEnabled exporting. This may be related to issue #5

@t-kelly
Copy link
Contributor

t-kelly commented Oct 4, 2018

Since the check for cookies it pretty straight forward and is not directly scoped to Shopify's Cart API, I decided not to include it in the v1 of theme-cart.

We definitely need to update this theme before upgrading to the latest version! Thanks.

@t-kelly t-kelly added the bug label Oct 4, 2018
@isaac-martin
Copy link
Contributor Author

Hey @t-kelly i might open a PR for this one if you want?

@t-kelly
Copy link
Contributor

t-kelly commented Dec 20, 2018

Hey @isaac-martin -- please see Shopify/theme-scripts#65 first.

I'd be down to just put the contents of the the cookiesEnabled function directly in Starter Theme for now until we sort out where it can live in theme-scripts.

@isaac-martin
Copy link
Contributor Author

Not a huge deal - on a bit of a code freeze until after Xmas so thought I'd put some work in here. I'll open an issue for something else I noticed and work on that instead if we give it the go ahead.

@Cam
Copy link
Contributor

Cam commented Mar 7, 2019

I'm using this for now:

// Apply a specific class to the html element for browser support of cookies.
if (window.navigator.cookieEnabled) {
  document.documentElement.className = document.documentElement.className.replace(
    'supports-no-cookies',
    'supports-cookies',
  );
}

Seems effective enough.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants