Detect the theme editor using Liquid and JavaScript
Themes
Effective February 03, 2021
You can now detect the theme editor programmatically using Liquid and JavaScript. In Liquid, you can use request.design_mode
. In JavaScript, you can use Shopify.designMode
.
Workaround methods, such as content_for_header contains
in Liquid, or searching the page URL in JavaScript, aren't supported and won't continue to work in the new theme editor. To make your app or theme compatible with the new theme editor, you need to update your code to use a supported method.
Learn more about detecting the theme editor on Shopify.dev.