Created
May 1, 2018 15:12
-
-
Save AdamSwinden/ae108ac33fa1b971850872335c2aed51 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
* Set Store Currency | |
*/ | |
function setStoreCurrency(globalCurrency) { | |
var currencySetUkButton = $( '.currencySetUk' ), | |
currencySetEuButton = $( '.currencySetEu' ), | |
currencySetUsButton = $( '.currencySetUs' ), | |
body = $( 'body' ); | |
// Set to local Storage value | |
if (globalCurrency) { | |
var currencyClass = 'currency-' + globalCurrency; | |
body.addClass(currencyClass); | |
} | |
currencySetUkButton.click( function() { | |
if ( !currencySetUkButton.hasClass('js-currency-toggle') ) { | |
$('.m1-header__currency-button--active').removeClass('m1-header__currency-button--active'); | |
currencySetUkButton.addClass('m1-header__currency-button--active'); | |
body.addClass('currency-uk'); | |
tomEraseCookie('globalCurrency'); | |
tomCreateCookie('globalCurrency', 'uk', 7); | |
location.reload(); | |
} | |
}); | |
// Continue for Each Store/Currency | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment