Using Dawn, How do i add a new field from my database

Topic summary

Goal: Display a database field named “custom” as a product variant in the Shopify Dawn theme product page.

Context: The user’s connector exposes a field called “custom” to Shopify. They want it treated as a variant option on the product page.

Current attempt: The user shared a screenshot (shopify1.png) and a Liquid code snippet from Dawn’s product options logic. The snippet maps product.variants to arrays (available, option1, option2, option3), builds product_form_id, and loops over option.values to set option_disabled based on availability.

Key question: The user asks if this shown code block is the correct place to integrate the new “custom” field as a variant option.

Technical note: The provided code handles up to three variant options (option1–option3) and controls enabling/disabling variant values.

Status: No confirmed solution yet; awaiting guidance on whether and how to incorporate “custom” into the variant options within this code. Image and code snippet are central to understanding the issue.

Summarized with AI on January 29. AI used: gpt-5.

Hi All,

Apparently my connector to my database allows a field called custom to be seen by Shopify.

How do I add this new field called custom as a product variant to the dawn product page?

Thank you

Hello,

Thank you for the reply. Is this it here?

{%- liquid
  assign variants_available_arr = product.variants | map: 'available'
  assign variants_option1_arr = product.variants | map: 'option1'
  assign variants_option2_arr = product.variants | map: 'option2'
  assign variants_option3_arr = product.variants | map: 'option3'

  assign product_form_id = 'product-form-' | append: section.id
-%}

{%- for value in option.values -%}
  {%- liquid
    assign option_disabled = true

    for option1_name in variants_option1_arr
      case option.position
        when 1
          if variants_option1_arr[forloop.index0] == value and variants_available_arr[forloop.index0]
            assign option_disabled = false
          endif
        when 2
          if option1_name == product.selected_or_first_available_variant.option1 and variants_option2_arr[forloop.index0] == value and variants_available_arr[forloop.index0]
            assign option_disabled = false
          endif
        when 3
          if option1_name == product.selected_or_first_available_variant.option1 and variants_option2_arr[forloop.index0] == product.selected_or_first_available_variant.option2 and variants_option3_arr[forloop.index0] == value and variants_available_arr[forloop.index0]
            assign option_disabled = false
          endif
      endcase
    endfor
  -%}