Com o tema Dawn, adicionar um atributo de produto personalizado ou caixa de texto foi simplificado. Você pode adicionar vários elementos de IU do Shopify, apenas certifique-se de que o nome e o ID sejam únicos. Siga as instruções abaixo.
Se você tiver temas GRATUITOS do Shopify 2.0, por favor, use a ferramenta gratuita de geração de campos aqui.
Observação: Se você tiver a página de produto Dawn-Debut, isso também funcionará.
Se você tiver um tema diferente. Isso não será aplicável, mas é possível. Envie-me uma mensagem se precisar de ajuda.
1. Vá para gerador de elementos de IU do Shopify.
2. Escolha o line-item-property. Certifique-se de clicar em "mostrar no checkout" se desejar que as informações sejam exibidas no momento do checkout. Clique em "copiar para a área de transferência"
3. Vá para sua Loja online > Temas > Ações > Editar código
4. Vá para a pasta de Seção e abra o main-product.liquid
5. Encontre este código abaixo. Deve estar sob o "{%- when 'buy_buttons' -%}
{%- form 'product', product, id: product_form_id, class: 'form', novalidate: 'novalidate', data-type: 'add-to-cart-form' -%} |
Para Dawn versão 8.0 e acima, abra o buy-buttons.liquid na pasta Snippet e encontre o mesmo código.
6. Cole o código após {% form ...... %}. Veja a imagem abaixo, onde colar.

Veja o código personalizado para estilo personalizado.
Adicione o código em azul ao seu código de Elemento de IU do Shopify
Para texto-curto (veja a imagem abaixo de como fica):
<p class="line-item-property__field"> <label for="seu-nome">Seu nome</label><br> <input id="seu-nome" type="text" name="properties[Seu nome]" style="width: 100%; line-height: 2;"> </p> |

Para texto-longo (veja a imagem abaixo de como fica):
<p class="line-item-property__field"> <label for="seu-nome">Seu nome</label><br> <textarea id="seu-nome" name="properties[Seu nome]" style="width:100%"></textarea> </p> |

Para dropdown (veja a imagem abaixo de como fica):
<p class="line-item-property__field"> <label>Seu nome</label><br> <select id="seu-nome" name="properties[Seu nome]" style="font-size: 1.5rem; width: 100%; padding: 2%;"> <option value="Vermelho">Vermelho</option> <option value="Branco">Branco</option> <option value="Azul">Azul</option |

Adicionar um carregador de arquivos.
<p class="line-item-property__field"> <label>Carregue sua imagem aqui </label> <input type="file" name="pic" accept="image/*"> </p> |
Para tornar os campos obrigatórios. Você precisa encontrar o código abaixo:
{%- form 'product', product, id: product_form_id, class: 'form', novalidate: 'novalidate', data-type: 'add-to-cart-form' -%} |
Em seguida, exclua `novalidate: 'novalidate'`. Depois adicione o atributo `required` ao seu campo de entrada.
Exemplo:
<p class="line-item-property__field"> <label>Carregue sua imagem aqui </label> <input type="file" name="pic" accept="image/*" required> </p> |

Adicionar um carregador de arquivos.
<p class="line-item-property__field"> <label>Carregue sua imagem aqui </label> <input type="file" name="pic" accept="image/*"> </p> |
Para tornar os campos obrigatórios. Você precisa encontrar o código abaixo:
{%- form 'product', product, id: product_form_id, class: 'form', novalidate: 'novalidate', data-type: 'add-to-cart-form' -%} |
Em seguida, exclua `novalidate: 'novalidate'`. Depois adicione o atributo `required` ao seu campo de entrada.
Exemplo:
<p class="line-item-property__field"> <label>Carregue sua imagem aqui </label> <input type="file" name="pic" accept="image/*" required> </p> |
Outra maneira é usar o bloco Liquid personalizado usando o editor de temas.
1. Acesse sua loja online > Temas > Personalizar
2. Vá para o modelo de produto. Em informações do produto, clique em "adicionar bloco" e encontre "Liquid personalizado".
3. Na caixa de texto, coloque o código que você tem para o campo de texto, mas adicione o código abaixo na área de texto ou entrada. Certifique-se de adicionar o código antes de ">", veja o exemplo abaixo
| form="product-form-{{ section.id }}" |
Veja o exemplo abaixo e o código adicionado está em negrito
| <p class="line-item-property__field"> <label for="your-name">Seu nome</label><br> <textarea id="your-name" name="properties[Seu nome]" style="width:100%" form="product-form-{{ section.id }}"></textarea> </p> |
Isso é tudo (",)
33 comentários
Please make sure to use the enhanced Shopify UI element tool https://made4uo.com/blogs/journey-to-awesome-shopify-website/enhanced-shopify-ui-elements-generator-tool
I followed your tutorial for Dawn 13.0 and made it “Required field” for proceeding to add it to cart.
But it doesn’t work for Buy Now button, can you help me? I don’t want customers to proceed without selecting the required fields.
Its working perfect for add to cart but users can directly click on “Buy Now” without filling in the required options
Hi ALLIE HEMMINGS,
You need to create a product template and edit that template. Please check our video tutorial on how https://youtu.be/bg7l0lZcyOU?si=4KJ9Hdub0NxPuOns
I’m wanting to add a line item property to one product only, and don’t want it to appear on other product pages. How would I go about doing this? Thanks so much for your awesome tutorials!
Hi Nadia,
We had posted an answer in Shopify community similar to your problem. You can check the solution on the link provided.
https://community.shopify.com/c/online-store-and-theme/custom-liquid-field-in-product-form/td-p/2314479
Hello! I want to add a custom message field to only specific products (one collection). I created a new product template for these products, but I don’t know where to place the code so that it only applies to the new product template that I made. If I add the code as custom liquid in the theme editor, the customization message won’t appear at checkout. Please help!
Hi @Dani,
Please follow the video tutorial. I mentioned this
Hi, thank you for the easy to follow steps. I ran into an issue after adding the code to the main-product.liquid file. The textbox is showing on my product page, however the information doesn’t carry over to the Cart. Any idea why that might be? I am using Dawn 11. Thank you
Hi @HANNAH,
If you want to only apply the textbox to a certain product, I would recommend creating a new product template, and follow the instructions for adding the textbox using custom liquid.
Hi, I am using dawn 11.0 – when I add the code under buy-buttons.liquid like you mention it applies to all my listings – I created a custom-product.liquid so I can apply the custom text box to only certain listings but where would edit the custom template to input the UI Elements code? Being a newer version of Dawn it does not have the standard code within the template mentioned in step 5, only under buy-buttons.liquid