Last active
January 2, 2025 15:23
-
-
Save junaidkbr/6638192d65fc03e2e55a3d9f9a060f98 to your computer and use it in GitHub Desktop.
Shortcut: Open Shopify pages in Customizer from the frontend
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
const shopName = window.Shopify.shop.replace(".myshopify.com", ""); | |
const themeId = window.Shopify.theme.id; | |
let previewPath = ""; | |
if (window.location.pathname !== "/") { | |
previewPath = encodeURIComponent(window.location.pathname); | |
} | |
const customizerUrl = `https://admin.shopify.com/store/${shopName}/themes/${themeId}/editor?previewPath=${previewPath}`; | |
window.open(customizerUrl, '_blank'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment