I am using magento version. I have created custom option for product. I want to make checkbox by default checked. How can I implement this? enter image description here


You can't do that using available default options. You have to write jQuery to set the input box as checked. Please find some hints below:

open app/design/frontend/base/default/template/catalog/product/view/options/type/select.phtml

and Copy this file to your theme folder and put below jQuery code at the end of this file

<script type="text/javascript">
    jQuery(".checkbox").prop( "checked", true );

You also need to add jQuery support in case its not already added. Additionally you can set input box checked only when your conditions match to set it as checked in jQuery.

  • 1
    You should never edit in base files. I think you should modify the the file path to something like app/design/frontend/<packagename>/<themename>/template/catalog/product/view/options/type/select.phtml
    – Priyank
    Dec 23 '17 at 10:30
  • 2
    @Priyank Yes, you are right. I mentioned him to copy this file to his theme folder :) Dec 23 '17 at 10:34
  • Oh yeah sorry miss that part :p
    – Priyank
    Dec 23 '17 at 10:40
  • @HimmatPaliwal - thank you so much it worked
    – Aks
    Dec 23 '17 at 10:46
  • @Aks: You are always welcome.. Keep helping other community members! Dec 23 '17 at 10:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.