App reviews, troubleshooting, and recommendations
I'm trying to create a link to the app settings within a Shopify block using schema in Liquid. I want to include dynamic variables like shop.domain and block.id in the URL.
Here’s my code:
{% schema %} { "name": "block", "target": "body", "settings": [ { "type": "header", "content": "Customize [App Configuration Page](https://admin.shopify.com/store/{{ shop.domain }}/apps/myapp/{{ block.id }})" } ] } {% endschema %}
However, the variables {{ shop.domain }} and {{ block.id }} are not being parsed within the schema. The link displays as plain text rather than dynamically replacing these variables.
Is there a way to include dynamic variables in the link within the Shopify block schema? If not, are there any recommended workarounds for creating dynamic links in Shopify blocks?
Hey @greg11223
Shopify's schema JSON section doesn’t support Liquid templating directly, which is why your variables like {{ shop.domain }} and {{ block.id }} aren’t being parsed. Liquid variables can only be used in the main Liquid template outside the JSON schema.
Here's how you can structure it:
{% assign app_link = "https://admin.shopify.com/store/" | append: shop.domain | append: "/apps/myapp/" | append: block.id %}
<div>
<h2>Customize App Configuration</h2>
<p><a href="{{ app_link }}" target="_blank">Go to App Configuration Page</a></p>
</div>
{% schema %}
{
"name": "block",
"target": "body",
"settings": [
{
"type": "header",
"content": "Customize the App Configuration from your Shopify Admin."
}
]
}
{% endschema %}
This approach will create a clickable, dynamic link that takes users to the app configuration page while displaying the section header within the schema.
Best Regards,
Moeed
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024