<div data-component='product'>
  {% assign current_variant = product.selected_or_first_available_variant %}

  {% comment %} {% unless product.has_only_default_variant %}{% endunless %} {% endcomment %}
  {% include 'product-head' %}
  <section data-component='productSelection'>
    <div class='outer'>
      <div class='container--l mxa'>
        <div class='slater-product f aic jcb fw'>

          <div class='slater-product__images'>
            <ul>
              {% for image in product.images %}
                <li>
                  <img class='block x' src='{{ image.src | img_url: '600x' }}' alt='{{ image.alt | escape }}' />
                </li>
              {% endfor %}
            </ul>
          </div>
          <div class='slater-product__info'>
            <h1>{{ product.title }}</h1>

            <div class="rte">
              {{ product.description }}
            </div>

            <form action='/cart/add' method='post' enctype='multipart/form-data'>
              <div class='product-options-wrapper rel'>
                {% unless product.has_only_default_variant %}
                  <div class='py1'>
                    <h6 class='c-green'><em>use selects</em></h6>
                    {% for option in product.options_with_values %}
                      <div class='py05'>
                        {%- capture options -%}
                          {% for value in option.values %}
                            <option value='{{ value | escape }}'
                              {% if option.selected_value == value %}selected{% endif %}>
                              {{ value }}
                            </option>
                          {% endfor %}
                        {%- endcapture -%}
                        {%- capture attributes -%}
                          data-option-select
                          data-index='{{ forloop.index0 }}'
                        {%- endcapture -%}
                        {%
                          include 'component-select' with
                          label: option.name,
                          name: option.name,
                          attributes: attributes
                          options: options
                        %}
                      </div>
                    {% endfor %}
                  </div>

                  <div class='py1'>
                    <h6 class='c-green'><em>or radios</em></h6>
                    {% for option in product.options_with_values %}
                      <div class='py05'>
                        <label>{{ option.name }}</label>
                        <div class='radio-group f aic' data-option-radio data-index={{ forloop.index0 }}>
                          {% for value in option.values %}
                            {%
                              include 'component-radio' with
                              label: value,
                              value: value,
                              name: option.name,
                              checked: option.selected_value == value
                            %}
                          {% endfor %}
                        </div>
                      </div>
                    {% endfor %}
                  </div>
                {% endunless %}

                {%- capture options -%}
                  {% for variant in product.variants %}
                    <option value='{{ variant.id }}'
                      {% if variant == product.selected_or_first_available_variant %}selected{% endif %}
                      {% unless variant.available %}disabled{% endunless %}>{{ variant.title }}</option>
                  {% endfor %}
                {%- endcapture -%}

                {%
                  include 'component-select' with
                  name: 'id',
                  options: options,
                  attributes: 'data-option-main',
                %}
              </div>

              <div class='py1'>
                {% include 'component-counter' %}
              </div>

              <div class='f aic py1'>
                <span data-price>{{ current_variant.price | money }}</span>
                <s data-compare-price style='display: none'>{{ current_variant.compare_at_price | money }}</s>
              </div>

              <div class='py1'>
                {%- capture cta -%}
                  {% if product.available %}
                    Add to Cart
                  {% else %}
                    Out of Stock
                  {% endif %}
                {%- endcapture -%}
                {%
                  include 'component-button' with
                  tag: 'button',
                  name: 'add',
                  type: 'submit',
                  className: 'js-add-to-cart',
                  cta: cta
                %}
              </div>

              <script class='js-product-json' type='application/json'>{{ product | json }}</script>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
