Hello! How do I put a custom text field on product pages in Brooklyn theme? I found a few tutorials but none of them helped me.
Topic summary
A user seeks help adding a custom text field to product pages in Shopify’s Brooklyn theme.
Initial Solution Provided:
- Navigate to Online Store > Themes > Edit Code
- Locate and modify
product-template.liquidto insert custom text field code - Update the product form by finding
product-form.liquidin the Sections folder - Add specific code above the “Add to Cart” button form to ensure the custom field value passes through when clicked
Implementation Issue:
The user successfully completed initial steps but encountered a problem at step 6—they cannot locate the product-form.liquid file in the Sections folder.
Alternative Files Suggested:
product.liquidproduct-template.liquid
Current Status:
After adding code from step 7, an error appears (screenshot provided). The discussion remains unresolved as the user awaits further guidance on the correct file location and error resolution.
Hello @POZ_K
- In your Shopify Admin go to online store > themes > actions > edit code
- Find product-template.liquid Add the custom text field: Open the “product-template.liquid” file and search for the area where you want to add the custom text field. For example, you might want to add it below the product title or above the add to cart button.
- Insert the code for the text field: Use the following code snippet to create a custom text field:
- In this code, “Custom Field” is the name of the custom field you want to add. You can modify the label text and input field attributes to suit your needs.
- Save the changes: After adding the code, save the file.
- Update the product form: Now, find the “product-form.liquid” file located in the “Sections” folder. Open it and search for the tag. Inside the form, find the line that looks like this:
{{ form | payment_button }}
- Add the following line of code just above it:
{{ form | payment_button, product_form_id: 'AddToCartForm' }}
-
This ensures that the custom text field value is passed through when the “Add to Cart” button is clicked.
-
Save and test: Save the changes to the “product-form.liquid” file and preview your store. Go to a product page and check if the custom text field appears as expected.
I did everything good, but on the step 6. I can’t find “product-form.liquid” file in the “Sections” folder. it’s not there.
