Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
I'm trying to add a checkbox to my checkout page (the checkbox text would be: Do you need an alibi ln your package. In the form of Congratulations on winning this ltem'?)
I've gone through the forums and found a way to add it to the code. It worked by adding it to the code but when I sent through a test order, it does not show on my end whether or not the customer selected the checkbox.
Is there another way of doing this, so that as the shop owner I can see whether or not the customer has selected the checkbox?
Solved! Go to the solution
This is an accepted solution.
Hi jraymond12,
Please go to 'Online store' -> 'Actions' -> 'Edit code' and add this to your cart.liquid file in between the <form> </form> tags. It will appear where you place the code. And this will show up on each order in the top right:
<p class="cart-attribute__field">
<input type="hidden" name="attributes[Do you need an alibi ln your package. In the form of Congratulations on winning this ltem'?]" value="No">
<input type="checkbox" name="attributes[Do you need an alibi ln your package. In the form of Congratulations on winning this ltem'?]" value="Yes"{% if cart.attributes["Do you need an alibi ln your package. In the form of Congratulations on winning this ltem'?"] == "Yes" %} checked{% endif %}>
<label>Do you need an alibi ln your package. In the form of Congratulations on winning this ltem'?</label>
</p>
This is an accepted solution.
Hi jraymond12,
Please go to 'Online store' -> 'Actions' -> 'Edit code' and add this to your cart.liquid file in between the <form> </form> tags. It will appear where you place the code. And this will show up on each order in the top right:
<p class="cart-attribute__field">
<input type="hidden" name="attributes[Do you need an alibi ln your package. In the form of Congratulations on winning this ltem'?]" value="No">
<input type="checkbox" name="attributes[Do you need an alibi ln your package. In the form of Congratulations on winning this ltem'?]" value="Yes"{% if cart.attributes["Do you need an alibi ln your package. In the form of Congratulations on winning this ltem'?"] == "Yes" %} checked{% endif %}>
<label>Do you need an alibi ln your package. In the form of Congratulations on winning this ltem'?</label>
</p>
Thank you Alpha_Geek! That worked perfectly.
I am also trying to do this but I don't have the <form> </form> tags.
This is the code I have-
{% comment %}
The contents of the cart.liquid template can be found in /sections/cart-template.liquid
{% endcomment %}
{% section 'cart-template' %}
Finally got it. Tried to delete last comment but cannot, so please just ignore 🙂
User | RANK |
---|---|
41 | |
37 | |
29 | |
15 | |
12 |