I'm creating an app that adjusts certain parts of the UI depending on the theme that the user is viewing.
For example, there's 8 Free Shopify Themes available for shop owners to install:
const VentureTheme = document.querySelector('#ventureTheme');
But sadly this does not exist.
I'm curious if any developers can share any tips n tricks on what they've learned along the way for targeted theme customization.
Solved! Go to the solution
This is an accepted solution.
The Shopify rest api has a theme object that includes a 'name' property.
Hope that helps.
just to be completely thorough, the code I'm using to generate a theme body class is:
let themeName = Shopify.theme.name; let className = 'oneezy__theme-' + themeName.split(" ").toLowerCase(); let body = document.querySelector('body') body.classList.add(className);
Result: <body class="oneezy__theme-name">