Making a custom field (pick your own flavors) mandatory on product page

We have a few products that are pick your own flavor packs that allow the customer to mix and match the products. Here is an example: https://shop.itsjerkyyall.com/products/3-pack-sampler-special

It works fine, but currently, they can still add to the cart without even picking any flavors. We want to make the custom flavor picking fields mandatory.

Is there something we are missing from the code?

{% else %} {% comment %} If there is no more than one product variant {% endcomment %}
                      
                    {% endif %}

                 
                  

                    

                      
                      
                      
                    

                    
                      x
                      
                        {{ product.selected_or_first_available_variant.price | money }}
                      
                      =
                      
                        {{ product.selected_or_first_available_variant.price | money }}
                      
                    
                  

                    

                    
                    

                    

                    
                    

                    

                    
                    

                  
                  
                    
                  

                
              

Hello,

You are missing the validations. There is 3 ways do it.

  1. Disable the ajax cart (add to cart without page reload ) and implement html required. You can check here
  2. Find out the ajax function in js file and prevent ‘add to cart’ if flavor selection is blank.
  3. Write another JS function and check fields values. If true then allow it perform it’s action else prevent it and show validation with a message to select flavor first.

You can try first one if theme allows you to disable ajax.
For other 2 you have to customize code.

Thanks

Hi Guleria

Can’t seem to disable the ajax cart

So looking at your 2 other options. Where would ajax function be? Can’t seem to find it

Thanks for your help