I’ve set up line item properties for personalizing products by using following custom liquid on the product page:
{% if product.handle contains “luggage-tag” %}
Name & Address for back of tag
{%- endif -%}
But the personalized information that they enter is not being passed to the cart. It works fine in all my old 1.0 themes, but I can’t figure out what I need to add to the cart page to get it to show up correctly in the 2.0 Studio theme.
Hi, I found this exact same thing copying my working code from Simple to Studio and spent the weekend on it…
Though a mix of inspecting the html and looking at the code for the variant selects I’ve ended up on this which does work, example of a text entry property below:
Enter your personalisation here:
I think the issue is that the original line item property code doesn’t reference a product form, and so the data isn’t included when the form gets submitted. If it isn’t this I can’t see what else it could be anyway!
Thanks so much for sharing what you did! I just tried it but there’s still nothing showing on the cart page. Did you edit anything on the cart page or just the product page? I feel like there has to be some simple thing I’m just missing!
Ok I finally got it to work…it doesn’t work if I try to do it from the customizer page (I had been using a custom liquid field there to add the line item property code). But if I go to the main-product-liquid section and add it right after line 432 which reads:
I am also encountering the same issues now with Personalization. What exactly do you mean by “But if I go to the main-product-liquid section …” can you explain further on the steps? Thanks in advance.
To get to the place where you can edit the code: From the shopify admin click “Online store” on the left menu. Then go to your theme, and next to it where it says customize, publish, etc. click the 3 dots and from that menu click “edit code”. Scroll down through the items on the left until you get to “sections” and expand that. In there you should find one called main-product-liquid - open it and the code will display on the right. Then you can change the code as described in the solution above, save, and hopefully it will work!
Yes, I found the main-product-liquid. However, I have personalisations for some products, not all. Will this code affect ALL my products? I am using Studio Theme. I have already created Metafields in the product that I offer Personalisations. But the Line Item Properties is not captured at Cart checkout infor. You are so helpful and thank you in advance!
It shouldn’t affect anything on the other products because they won’t have the line item properties, it should just pass through the code to the ones that have them. So hopefully it’ll work ok for you!
OK, so as I am clueless with coding, can you be specific on Section —> main-product-liquid, and then what code do I put in and which line do I put in, coz’ it’s lines and lines of codes in main-product-liquid. I have a screenshot of what my line 432 looks like currently.
Hmm they must have done an update that changed what is on what line, that isn’t the right place to put it. You’re looking for code that looks like this:
then your line item code would go right after that. If you’re doing it with metafields that may be a bit different…I’m afraid I’m not actually a coder either and have just figured out a lot of this by trial and error, and metafields are newer and have changed how some of this works since I set mine up. But I think what you would need to do is to reference your metafield there so that it would pull in the line item info from your metafields. Sorry I can’t be more help with that part of it as I haven’t done it that way myself so I’m not exactly sure how to work it!
Chat GPT is actually pretty good at figuring this stuff out and sometimes if you ask it what to do and paste your code in it can help you figure out how to get it to do what you want! Good luck!