Adding dynamic section that contains a YOTPO widget

slee
New Member
1 0 0

I am a complete newb at theme structure and trying to figure out how to display a YOTPO widget instead of the words "true" and "false" for my checkbox schema. I want to be able to toggle the widget on and off within the theme editor. Here's my theme section code:

 

{{ section.settings.toggle_gallery }}
<div
     class="yotpo yotpo-pictures-widget"
     data-gallery-id="xxxxxxxxxxxxxxxxx">
</div>

{% schema %}
{
  "name": "YOTPO Gallery",
  "settings": [
    {
   "type": "checkbox",
   "id": "toggle_gallery",
   "default": true,
   "label": "Enable Gallery"
	}
  ],
  "presets": [
    {
      "name": "YOTPO Gallery",
      "category": "Galleries"
    }
  ]
}
{% endschema %}

{% stylesheet %}
{% endstylesheet %}

{% javascript %}
{% endjavascript %}
0 Likes
sarhov
Shopify Expert
482 85 154

Hm, it is pretty simple,

{% if  section.settings.toggle_gallery %}
<div
     class="yotpo yotpo-pictures-widget"
     data-gallery-id="xxxxxxxxxxxxxxxxx">
</div>

{% endif %}

))))

Author: Hovhannes Sargsyan (aka sarhov)
Email: shopify@sarhov.com
Website: https://sarhov.com
Try Shopify free for 14 days,

0 Likes