Hi guys,
I have some JS that requires setting values defined in the theme editor and for it to trigger whenever the editor is updated.
Found the “shopify:section:load” function in the forum - it does fire as expected BUT it doesn’t pull the updated theme values?
E.g. in the code below I’ve just got a simple text setting “test_value” - if i change that value in the editor, the new value isn’t reflected in the console log.
Is there a way for shopify:section:load or a different function to reload the theme values?
<script>
document.addEventListener("shopify:section:load", function(event) {
console.log("{{ section.settings.test_value }}");
});
</script>
{% schema %}
{
"name": "Test Section",
"settings": [
{
"type": "text",
"id": "test_value",
"label": "A string",
"default": "Test"
}
],
"presets": [
{
"category": "Content",
"name": "Test Section"
}
]
}
{% endschema %}
{% stylesheet %}
{% endstylesheet %}
{% javascript %}
{% endjavascript %}