Last active
January 3, 2024 23:01
-
-
Save crftr/a2b690ef07ce204859b6e2ba16ec1489 to your computer and use it in GitHub Desktop.
When developing a SuiteCommerce Advanced site, it's nice to browse against the local version of code. This browser bookmarklet will add the "-local" to the current URL.
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
javascript: (function () { | |
var locationStr = window.location.toString(), | |
shopping = SC.SESSION.touchpoints.viewcart.replace( | |
"goToCart", | |
"shopping-local" | |
); | |
if (/-local.ssp/.test(locationStr)) { | |
window.location = locationStr.replace("-local.ssp", ".ssp"); | |
} else if (/(my_account|checkout).ssp/.test(locationStr)) { | |
window.location = locationStr.replace(".ssp", "-local.ssp"); | |
} else { | |
var path = window.location.pathname.substring(1); | |
window.location = window.location.origin + shopping + "#" + path; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment