I’ve tried many different ways, and nothing seems to add my custom field on my cart to the cart attributes like everywhere says you can. I don’t understand. I’ve even used Shopify’s UI generator and THAT’s not working either. Here is the code I add:
<p class="cart-attribute__field">
<label for="your-name">Your name</label>
<textarea required class="required" id="your-name" name="attributes[Your name]">{{ cart.attributes["Your name"] }}</textarea>
</p>
Then I’ve tried this:
<div style="width:300px; clear:both;">
<p>
<label for="delivery_date">Pick a delivery date:</label>
<input required class="required" id="delivery_date" type="text" name="attributes[delivery_date]" value="{{ cart.attributes.delivery_date }}" />
<span style="display:block" class="instructions"> We do not deliver during the weekend.</span>
</p>
</div>
That doesn’t work either, it has something to do with the attributes
but I can’t figure out what.
Anyone?
2
Answers
In the liquid cart section, inside
<form>
tag you should addinput
ortextarea
with name attributenote
.For example:
If you’ve pasted your code inside the
<form>...</form>
tags then the issue I see with your code is that setting the value is wrong:You can see this working at a development store: https://kotn-eu.myshopify.com pwd skufom