Adding and retrieving cart attributes

Hi all,

I am trying to add in a simple question which is responded to with radio buttons on my cart page. I have added the following code to main-cart-items.liquid:

<p class="cart-attribute__field">
<label>Skittles or Oreos</label><br>
<input required class="required" type="radio" name="attributes[Skittles or Oreos]" value="Skittles"{% if cart.attributes["Skittles or Oreos"] == "Skittles" %} checked{% endif %}> <span>Skittles</span><br>
<input required class="required" type="radio" name="attributes[Skittles or Oreos]" value="Oreos"{% if cart.attributes["Skittles or Oreos"] == "Oreos" %} checked{% endif %}> <span>Oreos</span><br>
</p>

This displays the following:

The functionality works perfectly on the cart screen but the problem is that when someone orders, I can’t find where their selection is stored in the order information.

Help! Please!

Hi @Monck Welcome to the community!

You need to store the value in the “line_item” object so that you can see what customer has selected when they have completed their order, and once you store it in the line_item you can see customers selection under notes.

Hopefully it will help you. If yes then Please don’t forget hit Like and Mark it as solution!

Best Regards

Sahil

Thanks Sahil. Next question. How do I do this?

Sorry for all the questions, I’m a newbie!