Adding dynamic section that contains a YOTPO widget

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
Shopify Partner
455 80 98

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).
An individual web developer focused on Shopify development.
Need more help? Feel free to send me a direct message or drop an email shopify@sarhov.com

Website: https://sarhov.com  
Email: shopify@sarhov.com
Skype: @sarhov
Messenger: @sarhov
Telegram: @sarhov
0 Likes