-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add variant conditional statement to the shipping facets
- Loading branch information
Showing
5 changed files
with
42 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { canUseDOM } from 'exenv' | ||
|
||
function getCookie(cname) { | ||
if (!canUseDOM) { | ||
return undefined | ||
} | ||
|
||
const name = `${cname}=` | ||
const decodedCookie = decodeURIComponent(document.cookie) | ||
const ca = decodedCookie.split(';') | ||
|
||
for (let i = 0; i < ca.length; i++) { | ||
let c = ca[i] | ||
|
||
while (c.charAt(0) === ' ') { | ||
c = c.substring(1) | ||
} | ||
|
||
if (c.indexOf(name) === 0) { | ||
return c.substring(name.length, c.length) | ||
} | ||
} | ||
|
||
return undefined | ||
} | ||
|
||
export default getCookie |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters