How to make a product option in cart MANDATORY

Dear reader,

I just inserted an “add file” button into my custom product page. Can somebody help me how to make this option mandatory before being able to add the item to the cart?

My store link is: https://ux2i8jcyvivwwmc1-62119084228.shopifypreview.com

Thank you in advance!

Kind regards,

Mel

Hi @mel999

Thank you for reaching out to the Shopify forums!

Let me quickly fix that issue for you.

Please follow the below steps:

  1. Login to your store
  2. Go to the Online Store > themes > edit code > find product-template or product-form file
  3. Find this attributes novalidate=“novalidate” and remove it
  4. Save the file and check the product page

That’s it!

If its working then, please do not forget to accept this solution :face_savoring_food:

Note: If you are not aware about liquid code then, please do let me know so I will do it for you.

Thanks & Regards,
Prezen Tech

Dear Pezen Tech,

Thank you so much for your answer. However, I manually coded this option into the css as can be seen here.

Photo (JPG/PNG/PDF)

I am indeed unexperienced with coding so: perhaps you could tell me what I should add to this code? Thank you so much for the effort in advance, it is greatly appreciated!

Greetings,

Mel

store link is: https://le91a8g5djzddja8-62119084228.shopifypreview.com

@mel999 Please share your store URL with .myshopify.com here and allow me to check for you.

Thank you for your reply! My store url is: https://phantommousepads.myshopify.com/?_ab=0&_fd=0&_sc=1

Hi @mel999

Sure, let me explain you.

Please check the attached screenshot, here I am showing to remove one line from the code. If you do this then, your image field become mandatory.

Please try and let me know!

Thank you so much! It works :slightly_smiling_face: This helps a ton. Very grateful!!!

Hi @mel999 ,

I see that you have already received a suggestion to make your file upload option mandatory. However, I would like to propose an alternative solution that is simpler and doesn’t require any coding. This solution can be beneficial not only for you but also for other members who may encounter similar issues in the future :hugs: .

To implement this solution, you can utilize the Easify Product Options app to create your custom options, specifically the File Upload option. You can easily set it as “required” within the app.

Here’s a quick demonstration of how you can use the app for your setup:

In addition to the File Upload option, the Easify Product Options app offers over 20 different option types, allowing you to meet all your needs for creating custom options :victory_hand: .