I’m using the Studio theme and have a custom liquid block on my product page through the theme customization. The block is a drop-down selector (see the code below), which displays fine. The problem is I can’t get the data into the backend of the site. When I try to send it to the product form, the select tag translates to this:
If I hardcode the form name, it works fine (which I know is very bad and won’t do). My question is, is there different code I should be using for it to send the data to the correct form?
Can you share a little more about the big picture idea? What are you trying to achieve?
In my short sightedness it seems like you should just add a colour variant to the product? But I’m assuming there’s some other reason why you need to do it this way?
What do you want to do with that information you’re collecting and where do you want it to go?
Thank you for the reply. I (want to) have a custom product where the customer can choose 8 colours from a list of 20. I want a dropdown for each colour. I need to access the information once the order has been submitted to make the product. I just don’t understand why I can’t access a liquid variable inside a custom liquid block.
I tried to put a dropdown directly into my custom-product.liquid file but no changes I make show up on the page. Interestingly, changes I made to main-product.liquid show up instead. And yes, I’m sure the template for the product is correct. Any changes I made to the custom product page in the theme editor affect only the custom page.
I fixed the liquid template file problem. I forgot to change the type in json file associated with the custom product template. So now I can add the dropdowns directly to the liquid file and it attaches them to the product form. Do you know why I wouldn’t be able to access a Shopify variable in a custom liquid code block through the theme editor, though?
You should be able to access variables that are set for the global scope. So on the product page you can access the product object, but it depends what variable you’re trying to get and when that variable gets set.