Enable Disable a section or part of section depending on window.location.hostname within a template .json ? #3028
Unanswered
dshahin123
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
\n <tr class="row1">\n <td class="col1">\n Weight\n </td>\n <td class="col2">\n {{ product.metafields.custom.weight }} \n </td>\n </tr><tr class="row2">\n <td class="col1">\n Dimensions\n </td>\n <td class="col2">\n {{ product.metafields.custom.dimensions }} \n </td>\n </tr>\n</table>",Not sure if this is possible? Very new to all of this.
But here is what I am looking to do:
The "collapsible_row-4" is only required when accessing this page on our .fr & .it domains and so I would like to only make it enabled on those pages - I was trying to form some sort of if/else statement based on window.location.hostname == our .fr || .it domains but I cannot seem to get it to work? Any help would be greatly appreciated! (I have attached the whole .json file & also the .liquid for the collapsible content it is calling for this section)
Section:
"2cbaf563-3af7-4130-8215-7565a7511b86": {
"type": "collapsible-content-2",
"blocks": {
"template--19225607635265__2cbaf563-3af7-4130-8215-7565a7511b86-collapsible_row-1": {
"type": "collapsible_row",
"settings": {
"heading": "Details",
"icon": "check_mark",
"row_content": "",
"liquid": "{{ product.metafields.custom.details_tab_content }}",
"page": ""
}
},
"template--19225607635265__2cbaf563-3af7-4130-8215-7565a7511b86-collapsible_row-2": {
"type": "collapsible_row",
"settings": {
"heading": "Technical Specs",
"icon": "check_mark",
"row_content": "",
"liquid": "
"page": ""
}
},
"template--19225607635265__2cbaf563-3af7-4130-8215-7565a7511b86-collapsible_row-3": {
"type": "collapsible_row",
"settings": {
"heading": "Warranty",
"icon": "check_mark",
"row_content": "
{{ product.metafields.custom.warranty_tab_content | metafield_tag }}</p>",
"liquid": "",
"page": ""
}
},
"template--19225607635265__2cbaf563-3af7-4130-8215-7565a7511b86-collapsible_row-4": {
"type": "collapsible_row",
"settings": {
"heading": "Package Recycling",
"icon": "check_mark",
"row_content": "",
"liquid": "<script id='buyerdock-api' data-api='5eU73ihMKY1695729119lRLAIZ' data-product='{{ product.metafields.custom.buyerdock_widget }}' src='https:\/\/buyerdock.com\/buyerdock_api\/api_response.js'></script>",
"page": ""
}
}
},
"block_order": [
"template--19225607635265__2cbaf563-3af7-4130-8215-7565a7511b86-collapsible_row-1",
"template--19225607635265__2cbaf563-3af7-4130-8215-7565a7511b86-collapsible_row-2",
"template--19225607635265__2cbaf563-3af7-4130-8215-7565a7511b86-collapsible_row-3",
"template--19225607635265__2cbaf563-3af7-4130-8215-7565a7511b86-collapsible_row-4"
],
collapsible content liquid file .pdf
".json" whole file.pdf
Beta Was this translation helpful? Give feedback.
All reactions