Add a required field to the cart page of Sense 2.0 theme

Hey!

I’d like to add a required field to the cart page of the Sense 2.0 theme.

Does anybody know how to do that?

I tried the Shopify UI Elements Generator as well as the app “Required”, but both options don’t work.

  • Lars :slightly_smiling_face:
1 Like

@larsgro

oh sorry for that issue if possible to add that code and share store url so i will check and let you know

Hi @larsgro ,

Please add below code after line number 77 in main-cart-items.liquid


Hey @gr_trading

Thanks for your reply!

I added the code, but the field is below every product on the cart now. Is it possible to add it to the cart page only once?

@larsgro ,

To enable mandatory field only once you need to put below code just before to line no. 289, after {%- endfor -%}


            
              
            

below is screenshot for reference

Result screenshot

Thank you so much @gr_trading !

Is there a possibility to make the field bigger and add a description above it?

Then the solution is found :grinning_face_with_smiling_eyes:

@larsgro ,

Replace input code with below one


Hope this would be desired solution :wink:

Hey @gr_trading

Thanks for the edited code :grinning_face_with_smiling_eyes:

There’s one thing left: do you know how to add a description above the field? So customers know what they have to put in the field?

Thanks again for your response, appreciate it!

Oh and another thing I just noticed @gr_trading :

How do I see the information they wrote in the field in the order itself?

@larsgro


Hey @gr_trading

The field is bigger now but the description doesn’t show up…

And I can’t see the details the customer put in in the order itself, do you know how to add them?

Thanks so much for your response :grinning_face_with_smiling_eyes:

@larsgro ,

Change name=“properties[cart name]” with name=“attributes[cart name]”


Thanks so much for the swift reply @gr_trading !

I just can’t seem to add a description above the field…

After that, the problem is solved :grinning_face_with_smiling_eyes:

@larsgro ,

Kindly replace the code with below one.


If your issue resolve, don’t forget to like and mark as solution.

1 Like

Thank you so much @gr_trading ! :grinning_face_with_smiling_eyes: