Liquid, JavaScript, themes, sales channels
Hello,
I'm making some updates to Debut and I need to know which theme style has been selected from the Customize area.
How can I get this information?
I tried this:
var Shopify = Shopify || {};
Shopify.theme = Shopify.theme || {};
console.log(Shopify.theme.style)
However, what I get are null values even though I have selected a specific style:
One thing I notice is that even though I have selected a style, it doesn't seem to stay selected (have the small green border on the left side).
What could be causing this issue?
Thanks in advance!
Hi @Matt99,
It really doesn't work well now, but if you want to look it up, it's in the config/settings_data.json file. Refer https://i.imgur.com/4BGwZFd.png
Hope it helps!
Hi @LitExtension,
Thanks for the reply.
I can see it in `config/settings_data.json`, but I need a way to check which style is currently selected on the theme and use this information in the liquid code.
And I can't do this from settings_data.json directly.
Hi @Matt99,
You can add a json variable to check this: https://i.imgur.com/gN2VP8q.png
Then you can add the variable or check it at the layout file with code: {{ settings | json }} . Ex: https://i.imgur.com/TSAGeyD.png
Note: Shopify is developing this, it doesn't really work well and there are many bugs. Therefore, you should be careful in using it.
Thanks for the reply.
Unfortunately, I already tried this yesterday and it's not working as well.
Hope Shopify will develop a solution for this bug.
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024