Where to insert the <form> code

13 0 0

Hey guys,

after finally getting where I want from a functionality point of view, I need your design advice now.


Part of the code for my solution contains a <form> section, which I want to appear on my product page(s). By assigning a "name" attribute, a Javascript then reads out the input of that form. The only way to get it to work for me was to insert the script into the "product-template.liquid" file in the Sections folder and apply the code for the form to the "product.liquid" file in the theme folder. This, however, makes for quite an inelegant solution: Due to the nature (?) of the product.liquid file, I can't choose the precise spot where the form appears. Currently, it is displayed just below the product description, but I'd rather have it appear somewhere around the "Add to Cart" button.


I know that this can be achieved by editing the product template in the sections folder, but when applying this solution, the data transfer from the form to Javascript stops working.


Any advice on that?