I am trying to add mandatory check buttons to 2 of my custom product pages. I have the boxes but it is allowing to not check boxes and checkout. I have tried all the things I have found on here and google and nothing works
Topic summary
Goal: Require two checkboxes on custom product pages to be checked before allowing checkout.
Current issue: Checkboxes exist but customers can proceed to checkout without checking them. Multiple attempted fixes from forum/Google did not work.
Technical detail: A jQuery (JavaScript) click handler on “.checkout-btn” was shared to prevent checkout unless both checkboxes are :checked. The user is unsure where in the Shopify theme to place this script and refers to it as “java.” The checkbox texts are: “Yes I have uploaded high resolution files (PNG 300dpi, SVG, EPS, Illustrator)” and “Yes I have uploaded with transparent background.” The code snippet is central to understanding the problem.
Suggestion: Another participant linked to a third-party “terms-checkbox” code resource (edcodes.gumroad.com) that purportedly solves the issue.
Outcome/status: No confirmed resolution. Key open questions: correct script placement in the Shopify theme and proper targeting/selectors for the checkboxes to ensure checkout is blocked until both are checked.
myself. I have managed doing all without trouble
I tired both and neither worked where would I put the java one? maybe im putting in wrong place
this is how its typed
$(document).on(‘click’, ‘.checkout-btn’, function(event) { if ($(‘.Yes I have uploaded high resolution files (PNG 300dpi, SVG, EPS, Illustrator), Yes I have uploaded with transparent background**:checkbox**:checked’).length < 2) { event.preventDefault(); alert(‘Please select both checkboxes before proceeding to checkout.’); } });
bolded are checkbox names
I think his code can solve your probem