Make text input a required field, so that shoppers can’t add to cart without filling them

Hello

How to make my text input a required field, so that my shoppers can’t add the product to the cart without filling this field. Add “Fill Out This Field” tooltip in case the input fields are left empty.

{%- if section.settings.product != blank -%}
{% include ‘global-variables’ %}
{%- assign product = all_products[section.settings.product] -%}
{% include ‘product-res-variables’ %}
{%- assign image_size = image_size | default: ‘470x’ -%}
{%- assign reverse = reverse | default: section.settings.reverse -%}
{%- assign show_arrows = show_arrows | default: section.settings.show_arrows -%}
{%- assign show_label_in_stock = show_label_in_stock | default: section.settings.show_label_in_stock -%}
{%- assign show_label_pre_order = show_label_pre_order | default: section.settings.show_label_pre_order -%}
{%- assign show_label_out_stock = show_label_out_stock | default: section.settings.show_label_out_stock -%}
{%- assign show_label_sale = show_label_sale | default: section.settings.show_label_sale -%}
{%- assign show_label_new = show_label_new | default: section.settings.show_label_new -%}
{%- assign show_label_hot = show_label_hot | default: section.settings.show_label_hot -%}
{%- assign show_collections = show_collections | default: section.settings.show_collections -%}
{%- assign show_title = show_title | default: section.settings.show_title -%}
{%- assign show_sku = show_sku | default: section.settings.show_sku -%}
{%- assign show_barcode = show_barcode | default: section.settings.show_barcode -%}
{%- assign show_availability = show_availability | default: section.settings.show_availability -%}
{%- assign show_type = show_type | default: section.settings.show_type -%}
{%- assign show_vendor = show_vendor | default: section.settings.show_vendor -%}
{%- assign show_price = show_price | default: section.settings.show_price -%}
{%- assign show_sale_details = show_sale_details | default: section.settings.show_sale_details -%}
{%- assign show_options = show_options | default: section.settings.show_options -%}
{%- assign show_custom_options = show_custom_options | default: settings.product_show_custom_options -%}
{%- assign show_size_guide = show_size_guide | default: section.settings.show_size_guide -%}
{%- assign show_delivery_return = show_delivery_return | default: section.settings.show_delivery_return -%}
{%- assign show_quantity = show_quantity | default: section.settings.show_quantity -%}
{%- assign show_button_add_to_cart = show_button_add_to_cart | default: section.settings.show_button_add_to_cart -%}
{%- assign show_button_add_to_wishlist = show_button_add_to_wishlist | default: section.settings.show_button_add_to_wishlist -%}
{%- assign show_button_add_to_compare = show_button_add_to_compare | default: section.settings.show_button_add_to_compare -%}
{%- assign show_button_dynamic_checkout = show_button_dynamic_checkout | default: section.settings.show_button_dynamic_checkout -%}
{%- assign show_dynamic_checkout_confirmation = show_dynamic_checkout_confirmation | default: section.settings.show_dynamic_checkout_confirmation -%}
{%- assign styled_dynamic_checkout = styled_dynamic_checkout | default: section.settings.styled_dynamic_checkout -%}
{%- assign show_reviews = show_reviews | default: section.settings.show_reviews -%}
{%- assign hide_reviews_counter = hide_reviews_counter | default: section.settings.hide_reviews_counter -%}
{%- assign show_countdown = show_countdown | default: section.settings.show_countdown -%}
{% capture image_size_placeholder %}_{width}x.{% endcapture %}
{%- if settings.compare_type == ‘disable’ -%}
{%- assign show_button_add_to_compare = false -%}
{%- endif -%}
{%- if settings.wishlist_type == ‘disable’ -%}
{%- assign show_button_add_to_wishlist = false -%}
{%- endif -%}
{%- if settings.reviews_type == ‘disable’ -%}
{%- assign show_reviews = false -%}
{%- endif -%}
{%- if section.settings.layout == ‘1’ -%}
{%- assign mobile_centered = true -%}
{%- assign mobile_start = false -%}
{%- else -%}
{%- assign mobile_centered = false -%}
{%- assign mobile_start = true -%}
{%- endif -%}
{%- assign product_form_id = ‘product-form-’ | append: section.id -%}

{% capture container_html %}
{%- if section.settings.show_gallery -%}
{%- if section.settings.image != blank -%} {%- if section.settings.product_format_pjpg -%} {%- assign image_format = 'pjpg' -%} {%- else -%} {%- assign image_format = null -%} {%- endif -%} {%- capture image_id -%} data-image-id="{{ image.id }}"{%- endcapture -%} {% render 'rimage' with image: section.settings.image size: image_size format: image_format %} {%- else -%} {%- assign img_hover_url = hover_image | img_url: '1x1', format: image_format | replace: '_1x1.', image_size_placeholder -%}
{% render 'product-get-images' with url: url image: image image_size: image_size title: title %} {%- if show_arrows and product.images.size > 1 -%}
{% render 'icon-theme-006' %}
{% render 'icon-theme-007' %}
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- if show_label_in_stock or show_label_pre_order or show_label_out_stock or show_label_sale or show_label_new or show_label_hot -%}
{%- if show_label_hot -%} {% include 'product-get-label-hot' %} {%- endif -%} {%- if show_label_new -%} {% include 'product-get-label-new' %} {%- endif -%} {%- if show_label_sale -%} {% include 'product-get-label-sale' %} {%- endif -%} {%- if show_label_in_stock -%} {% include 'product-get-label-in-stock' %} {%- endif -%} {%- if show_label_pre_order -%} {% include 'product-get-label-pre-order' %} {%- endif -%} {%- if show_label_out_stock -%} {% include 'product-get-label-out-stock' %} {%- endif -%}
{%- endif -%} {%- if show_countdown -%}
{% capture countdown_title %}{{ 'products.product.countdown.title' | t }}{% endcapture %} {% render 'product-get-countdown' with countdown_date: countdown_date, countdown_type: 2, countdown_title: countdown_title, centered: centered mobile_centered: mobile_centered %}
{%- endif -%} {%- if show_collections and product.collections.size > 0 -%}
{% render 'product-get-collections' with product: product %}
{%- endif -%} {%- if show_reviews -%}
{%- if settings.reviews_type == 'default' -%} {% render 'product-get-review' with product: product type: 2 hide_counter: hide_reviews_counter hide_mobile_counter: hide_reviews_mobile_counter %} {%- elsif settings.reviews_type == 'growave' and settings.app_growave_enable == true -%} {% capture the_snippet_review_avg %}{% render 'ssw-widget-avg-rate-listing', product: product %}{% endcapture %} {%- unless the_snippet_review_avg contains 'Liquid error' or product.metafields.ssw['review'].avg == 0 -%} {{ the_snippet_review_avg }} {%- endunless -%}

{%- elsif settings.reviews_type == ‘loox’ and product.metafields.loox.num_reviews -%}

{%- endif -%}

{%- endif -%} {%- if show_sku or show_barcode or show_availability or show_type or show_vendor -%}
{%- if show_sku -%}

{{ 'products.product.sku' | t }}: {{ sku }}

{%- endif -%} {%- if show_barcode -%}

{{ 'products.product.barcode' | t }}: {{ barcode }}

{%- endif -%} {%- if show_availability -%}
{%- if quantity == 1 -%} {%- capture item -%}{{ 'layout.cart.items_count.one' | t }}{%- endcapture -%} {%- else -%} {%- capture item -%}{{ 'layout.cart.items_count.other' | t }}{%- endcapture -%} {%- endif -%}

{{ 'products.product.availability' | t }}: {% if available %}{{ 'products.product.availability_value_in_stock' | t: count: quantity, item: item }}{% else %}{{ 'products.product.availability_value_out_stock' | t }}{% endif %}

{%- endif -%} {%- if show_type -%}

{{ 'products.product.type' | t }}: {{ type }}

{%- endif -%} {%- if show_vendor -%}

{{ 'products.product.vendor' | t }}: {{ vendor }}

{%- endif -%}
{%- endif -%} {%- if show_price -%}
{% include 'product-get-price' %}
{%- if show_sale_details -%}

{%- if compare_at_price > price -%} {%- assign price_save = compare_at_price | minus: price -%} {%- assign price_save_money = price_save | money -%} {%- assign price_save_procent = price | times: 100 | divided_by: compare_at_price | minus: 100 | times: -1 -%} {{ 'products.product.price_sale_details_html' | t: price: price_save_money, procent: price_save_procent }} {%- endif -%}

{%- endif -%}
{%- endif -%} {%- if section.settings.description_content != blank -%}
{{ section.settings.description_content }}
{%- endif -%}
{%- if show_options and show_custom_options -%} {%- unless product.has_only_default_variant -%}
{% include 'product-get-options' with options_type: 2 options_show_title: true mobile_start: mobile_start %}
{%- endunless -%} {%- else -%} {%- assign variants_size = product.variants | size -%} {%- if variants_size > 1 -%} {%- assign enable_select_options_button = true -%} {%- endif -%} {%- endif -%}

{% if product.title contains ‘oh Wanted Studio 3D Customized Car Plate Keychain’ %}

<p class="line-item-property__field "

{%- if show_button_add_to_cart or show_options -%}

{% render 'product-get-variants' with product: product current_variant: current_variant show_options: show_options show_custom_options: show_custom_options, product_form_id: product_form_id %}
{%- endif -%} {%- if show_size_guide and product.metafields.sizeguide.html != 'hide' or show_delivery_return -%}
{%- if show_size_guide and product.metafields.sizeguide.html != 'hide' -%}
{% if product_popup_buttons_show_icon %}{% include 'icon-theme-091' %} {% endif %}{{ 'products.product.size_guide' | t }}
{%- endif -%} {%- if show_delivery_return -%}
{% if product_popup_buttons_show_icon %}{% include 'icon-theme-135' %} {% endif %}{{ 'products.product.delivery_return' | t }}
{%- endif -%}
{%- endif -%} {%- if show_button_dynamic_checkout -%} {% capture dynamic_checkout_html %}
{% form "product", product, id: null, class: "d-block m-0" %} {%- if show_dynamic_checkout_confirmation -%}
{% render 'icon-theme-146' %} {{ 'products.product.dynamic_checkout.confirmation' | t }}
{%- endif -%}
{{ form | payment_button }}
{% endform %}
{% endcapture %} {%- endif -%} {%- if section.settings.button_layout == '1' -%} {%- if show_quantity -%}
{% render 'product-get-quantity' with quantity_show_title: true quantity_type: 3, product_form_id: product_form_id %}
{%- endif -%} {%- if show_button_add_to_cart or show_button_add_to_wishlist or show_button_add_to_compare -%}
{%- if show_button_add_to_cart -%}
{% include 'product-get-button-cart' %} {%- if show_button_dynamic_checkout -%}
{{ dynamic_checkout_html }}
{%- endif -%}
{%- endif -%} {%- if show_button_add_to_wishlist or show_button_add_to_compare -%}
{%- if show_button_add_to_wishlist -%}
{%- if settings.wishlist_type == 'default' -%} {% include 'product-get-button-wishlist' %} {%- elsif settings.wishlist_type == 'growave' and settings.app_growave_enable == true -%} {% capture the_snippet_fave_icon %}{% render 'ssw-widget-faveicon' with product.id %}{% endcapture %} {%- unless the_snippet_fave_icon contains 'Liquid error' -%} {{ the_snippet_fave_icon }} {%- endunless -%} {%- endif -%}
{%- endif -%} {%- if show_button_add_to_compare -%}
{% include 'product-get-button-compare' %}
{%- endif -%}
{%- endif -%}
{%- endif -%} {%- elsif section.settings.button_layout == '2' -%} {%- if show_button_add_to_cart or show_button_add_to_wishlist or show_button_add_to_compare -%}
{%- if show_quantity or show_button_add_to_cart -%}
{%- if show_quantity -%}
{% render 'product-get-quantity' with quantity_show_title: true quantity_type: 3, product_form_id: product_form_id %}
{%- endif -%} {%- if show_button_add_to_cart -%}
{% include 'product-get-button-cart' with button_select_disable: true %}
{%- endif -%}
{%- endif -%} {%- if show_button_dynamic_checkout -%}
{{ dynamic_checkout_html }}
{%- endif -%} {%- if show_button_add_to_wishlist or show_button_add_to_compare -%}
{%- if show_button_add_to_wishlist -%}
{%- if settings.wishlist_type == 'default' -%} {% include 'product-get-button-wishlist' %} {%- elsif settings.wishlist_type == 'growave' and settings.app_growave_enable == true -%} {% capture the_snippet_fave_icon %}{% render 'ssw-widget-faveicon' with product.id %}{% endcapture %} {%- unless the_snippet_fave_icon contains 'Liquid error' -%} {{ the_snippet_fave_icon }} {%- endunless -%} {%- endif -%}
{%- endif -%} {%- if show_button_add_to_compare -%}
{% include 'product-get-button-compare' %}
{%- endif -%}
{%- endif -%}
{%- endif -%} {%- endif -%}
{% endcapture %} {%- if section.settings.bg_image != blank -%}
{%- if section.settings.height != 'auto' -%}
{%- endif -%}
{%- if section.settings.bg_image_mobile != blank -%}
{%- endif -%}
{{ container_html }}
{%- else -%} {{ container_html }} {%- endif -%}
{%- else -%} {% render 'no-blocks' with message: 'homepage.onboarding.no_content_message.one_product' %} {%- endif -%}

{% schema %}
{
“name”: “One product”,
“settings”: [
{
“type”: “product”,
“id”: “product”,
“label”: “Product”
},
{
“type”: “select”,
“id”: “layout”,
“label”: “Layout”,
“default”: “1”,
“options”: [
{
“value”: “1”,
“label”: “1 (mobile centered)”
},
{
“value”: “2”,
“label”: “2”
}
]
},
{
“type”: “checkbox”,
“id”: “reverse”,
“label”: “Reverse layout”,
“default”: false
},
{
“type”: “header”,
“content”: “Gallery”
},
{
“type”: “checkbox”,
“id”: “show_gallery”,
“label”: “Show gallery”,
“default”: true
},
{
“type”: “image_picker”,
“id”: “image”,
“label”: “Image”
},
{
“type”: “checkbox”,
“id”: “show_arrows”,
“label”: “Arrows”,
“default”: true
},
{
“type”: “header”,
“content”: “Labels”
},
{
“type”: “checkbox”,
“id”: “show_label_in_stock”,
“label”: “Show label ‘In stock’”,
“default”: false
},
{
“type”: “checkbox”,
“id”: “show_label_pre_order”,
“label”: “Show label ‘Pre order’”,
“default”: true
},
{
“type”: “checkbox”,
“id”: “show_label_out_stock”,
“label”: “Show label ‘Out of stock’”,
“default”: false
},
{
“type”: “checkbox”,
“id”: “show_label_sale”,
“label”: “Show label ‘Sale’”,
“default”: false
},
{
“type”: “checkbox”,
“id”: “show_label_new”,
“label”: “Show label ‘New’”,
“default”: false
},
{
“type”: “checkbox”,
“id”: “show_label_hot”,
“label”: “Show label ‘Hot’”,
“default”: false
},
{
“type”: “header”,
“content”: “Elements”
},
{
“type”: “checkbox”,
“id”: “show_collections”,
“label”: “Show the product’s collections”,
“default”: false
},
{
“type”: “checkbox”,
“id”: “show_title”,
“label”: “Show the product title”,
“default”: true
},
{
“type”: “checkbox”,
“id”: “show_price”,
“label”: “Show the product price”,
“default”: true
},
{
“type”: “checkbox”,
“id”: “show_sale_details”,
“label”: “Show sale price details”,
“default”: true
},
{
“type”: “textarea”,
“id”: “description_content”,
“label”: “Description content”,
“info”: “Clear field to remove description”,
“default”: “Description”
},
{
“type”: “checkbox”,
“id”: “show_sku”,
“label”: “Show product SKU”,
“default”: false
},
{
“type”: “checkbox”,
“id”: “show_barcode”,
“label”: “Show product barcode”,
“default”: false
},
{
“type”: “checkbox”,
“id”: “show_availability”,
“label”: “Show product stock status”,
“default”: true
},
{
“type”: “checkbox”,
“id”: “show_type”,
“label”: “Show product type”,
“default”: false
},
{
“type”: “checkbox”,
“id”: “show_vendor”,
“label”: “Show product vendor”,
“default”: false
},
{
“type”: “checkbox”,
“id”: “show_reviews”,
“label”: “Show product reviews”,
“default”: true
},
{
“type”: “checkbox”,
“id”: “hide_reviews_counter”,
“label”: “Hide reviews counter”,
“default”: false
},
{
“type”: “checkbox”,
“id”: “show_countdown”,
“label”: “Show countdown”,
“default”: true
},
{
“type”: “checkbox”,
“id”: “show_options”,
“label”: “Show options (variants)”,
“default”: false
},
{
“type”: “checkbox”,
“id”: “show_size_guide”,
“label”: “Show button ‘Size guide’”,
“default”: false
},
{
“type”: “checkbox”,
“id”: “show_delivery_return”,
“label”: “Show button ‘Delivery return’”,
“default”: false
},
{
“type”: “checkbox”,
“id”: “show_quantity”,
“label”: “Show quantity”,
“default”: false
},
{
“type”: “select”,
“id”: “button_layout”,
“label”: “Buttons layout”,
“default”: “1”,
“options”: [
{
“value”: “1”,
“label”: “1”
},
{
“value”: “2”,
“label”: “2”
}
]
},
{
“type”: “checkbox”,
“id”: “show_button_add_to_cart”,
“label”: “Show button ‘Add to cart’”,
“default”: true
},
{
“type”: “checkbox”,
“id”: “show_button_add_to_wishlist”,
“label”: “Show button ‘Add to wishlist’”,
“default”: true
},
{
“type”: “checkbox”,
“id”: “show_button_add_to_compare”,
“label”: “Show button ‘Add to compare’”,
“default”: true
},
{
“type”: “checkbox”,
“id”: “show_button_dynamic_checkout”,
“label”: “Show dynamic checkout button”,
“default”: false
},
{
“type”: “checkbox”,
“id”: “show_dynamic_checkout_confirmation”,
“label”: “Show dynamic checkout confirmation”,
“default”: false
},
{
“type”: “checkbox”,
“id”: “styled_dynamic_checkout”,
“label”: “Custom style for dynamic checkout button”,
“default”: false
},
{
“type”: “header”,
“content”: “Background image”
},
{
“type”: “image_picker”,
“id”: “bg_image”,
“label”: “Background image”
},
{
“type”: “select”,
“id”: “height”,
“label”: “Image height”,
“default”: “auto”,
“options”: [
{
“value”: “auto”,
“label”: “Auto adaptation to the image”
},
{
“value”: “fullscreen”,
“label”: “Fullscreen”
},
{
“value”: “fullscreen_header”,
“label”: “Fullscreen excluding header”
}
]
},
{
“type”: “image_picker”,
“id”: “bg_image_mobile”,
“label”: “Mobile background image”
},
{
“type”: “header”,
“content”: “Support”
},
{
“type”: “paragraph”,
“content”: “Watch video tutorials
},
{
“type”: “paragraph”,
“content”: “Read user manual
}
],
“presets”: [
{
“name”: “One product”,
“category”: “4) Collections”
}
]
}
{% endschema %}