Fix upload required validation is not working

If the upload field is marked as required, but you are still able to add the product to the cart without uploading a file follow the steps below.

In some cases, the required validation of the upload field is executed after instead of before the themes cart functionality.

To fix this you will have to add a manual placement of the upload lift button with the following code:

<div data-upload-lift="{{ product.id }}"></div>

Then add a DIV with the class "cl-cart-validate" around your specific "Add to cart" button:

<div data-upload-lift="{{ product.id }}"></div>
<div class="cl-cart-validate">
 <button type="submit" name="add">Add to cart</button>
</div>

Important:  Make sure that the upload container DIV is outside of the "cl-cart-validate" DIV. 

After you've completed this setup, the required validation should get executed before the add to cart functionality. 

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.