【发布时间】:2023-04-10 10:32:01
【问题描述】:
我的 setting_data.json(Deput Shopify 主题)文件:
{
"current": {
"checkout_error_color": "#ff6d6d",
"sections": {
"header": {
"type": "header",
"settings": {
"align_logo": "left",
"logo": "shopify:\/\/shop_images\/logo_9bb43dd5-21d6-442c-8a19-0f4adf03e13a.png",
"logo_max_width": 100,
"main_linklist": "main-menu",
"message": true,
"home_page_only": true,
"message_text": "Paw Paper – Edible Gift Wrap for Pets",
"message_link": "",
"color_bg": "#162950",
"color_text": "#ffffff"
}
},
如何在 Shopify 液体模板页面中获取部分标题变量?
我可以得到一个变量:
{% assign text_color = settings.color_text %}
{{ text_color }}
我需要在页面上显示自定义块并从 settings_data.json 获取数据
"1543393771012": {
"type": "custom-content",
"blocks": {
"1543393771012-1": {
"type": "image",
"settings": {
"image": "shopify:\/\/shop_images\/info.png",
"width": "50%",
"alignment": "center"
}
},
"1543393802354": {
"type": "html",
"settings": {
"code": "<p>Paw Paper is the world's first edible wrapping paper designed specifically for pets. Our edible paper is 100% all-natural, made from potato starch with Omega-3 enhanced beef flavoring. It's water-soluble so no tape required!<\/p> <p>Just lick it like a stamp or dab water on the edges to bind the seams.<\/p>",
"width": "50%"
}
}
},
但是,我无法获取并显示带有变量的数组。
请帮忙。
【问题讨论】:
-
你的 json 中的数组在哪里?
-
如何从 settings_data.json 获取 message_text 变量?
-
从第一个还是第二个?
-
我们先试试吧。
标签: arrays json shopify liquid