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
Cart page shows “There was an error while updating your cart” after adding a checkbox to capture a cart attribute.
Implementation: A hidden input sets attributes[Authority to Leave]=“No” and a checkbox sets it to “Yes” inside main-cart-items.liquid. Cart attributes are key–value pairs stored on the cart; main-cart-items.liquid is the items section; template/cart.json controls section order.
Update: The original poster reports the problem is solved but does not share the fix. Another user asks how it was resolved.
Reproduction and workaround (Dawn theme): No error when placing the acknowledgement checkbox in main-cart-footer; the error occurs when placed in main-cart-items. To satisfy a design requirement to show it higher on the page, a new section was created and inserted above main-cart-items via template/cart.json, which avoided the error.
Status: Partially resolved. A working workaround is documented; exact root cause and whether cart-js changes are required remain unclear.
Notes: An image shows the error message; it is not essential to understanding the solution.
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
Hi @lulu57 ,
Can you let us which code you are using for adding the check box?
Hi Zaczee,
Thanks for your reply. i used this code:
Authority to Leave
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
Hi Zaczee,
problem is solved.
Hey,
how did you resolve this problem?
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.