Cart error after adding checkbox on cart page

Cart error after adding checkbox on cart page

lulu57
Tourist
24 0 1
 

 I've just added to checkbox to my cart page to get more customer information. but when I clicked the checkbox, it shows a cart error: There was an error while updating your cart. Please try again.

please help me, thank you

000.jpg

Replies 5 (5)

zaczee
Globetrotter
855 46 43

Hi @lulu57 ,

 

Can you let us which code you are using for adding the check box?

 

lulu57
Tourist
24 0 1

Hi Zaczee,

Thanks for your reply. i used this code:

 

<p class="cart-attribute__field">
<input type="hidden" name="attributes[Authority to Leave]" value="No">
<input type="checkbox" name="attributes[Authority to Leave]" value="Yes"{% if cart.attributes["Authority to Leave"] == "Yes" %} checked{% endif %}>
<label>Authority to Leave</label>
</p>

 

I used this code in main-cart-items.liquid.

I think maybe I should change some code in cart-js? But not sure how to do it.

thank you

lulu57
Tourist
24 0 1

Hi Zaczee,

 

problem is solved. 

majesty1
Visitor
1 0 0

Hey,

how did you resolve this problem?

R-Daneel
Shopify Partner
15 0 19

I had the same problem in the Dawn theme. I didn't have the problem if I added an acknowledgement checkbox to main-cart-footer, but it did happen when I tried to add it to main-cart-items.

 

Because our creative team wanted the acknowledgement checkbox higher up on the page, I solved my issue by creating a new section and adding the new section separately to template/cart.json above main-cart-items.