how to add a inout text filed before add to cart button for specific collection's products

  1. Created metafield with name Display input field and type True or false.

  2. Code in snippets → buy-buttons.liquid

Just after this code

{%- form 'product',
        product,
        id: product_form_id,
        class: 'form',
        novalidate: 'novalidate',
        data-type: 'add-to-cart-form'
      -%}

Here is the code

{% if product.metafields.custom.display_input_field %}
             
              
            
            

          {% endif %}

Regard
Guleria