How can I make a product variant a checkbox in Boost theme?

In the Boost theme, to my understanding, this is the chunk that generates variant options in product-template.liquid in “sections”:

{% unless product.has_only_default_variant %}
  {% for option in product.options_with_values %}
    
      
      

      {%- if section.settings.size_chart_enabled and option.name == section.settings.size_chart_option_name -%}
        {{ 'products.product.show_size_chart' | t }}
        {%- assign show_size_chart = true -%}
      {%- endif -%}
    

  {% endfor %}
{% endunless %}

I’ve already created a separate template to generate my custom output; I want to make the last variant for a product into a checkbox. This applies only to the digital variant that gets sent through email, but, a customer has the option to send a physical gift box that contains a code. So, the default of this variant would be “no” (= customer gets an email only) and the option of “yes” (= customer mails the eVoucher as a physical item to an address). The reason for keeping it a variant is because there is a price addition with the box being sent in the mail.

Taking a step back: This product is available in a physical and digital format. Only for the digital format do you have the option to send a code as a Gift Box or to send it as an email. I do still have to add the functionality for the checkbox to appear ONLY when “Digital” is selected. When “Physical” is selected, then the gift box option should disappear and default to “No”. That’s not the issue I"m having, but just to clarify all the option in the screenshot. This is what I managed so far:

Since there are 3 variants, I single out the 3rd one with the {% if forloop.index0 ==2 %} and all of the code above goes into the {%- else -%} to apply to all other variants. This is the adjusted code (Please ignore the gross inline-css). Honestly, this just feels much too fragile:

{% unless product.has_only_default_variant %}
{% for option in product.options_with_values %}

{% if forloop.index0 == 2 %}

    

        {% for value in option.values %}
            {% if value == "Yes" %}
             
            
            {%- endif -%}
        {% endfor %}

    

{%- else -%}
    
      
      

      {%- if section.settings.size_chart_enabled and option.name == section.settings.size_chart_option_name -%}
        {{ 'products.product.show_size_chart' | t }}
        {%- assign show_size_chart = true -%}
      {%- endif -%}
    

{%- endif -%}

{% endfor %}
{% endunless %}

The main problem is that if I check the box and then uncheck it, the option will always show up as “Yes” in the checkout, with the pricing for Gift Box included. Once the checkbox is checked on, I don’t know how to un-check it functionally. Visually, the checkbox works great.

My lesser problem is that I am somewhat confused by the use of “option” instead of “variant”. I’m quite new to Shopify. My expertise runs more with more css, html, javascript, php and about a year’s worth of time (painfully) spent with Magento. Is using “option” the normal way of generating variants or could I expect to see more template variables starting with “variant” when generating variants in other themes?

If you’ve made it this far… Thank you :slightly_smiling_face: