Setting default Custom options checkbox checked in configurable product

We are using the configurable products feature of Magento to group together some of our products that differ for example only by colour or number of items in a pack. In our case there is just a single “option” for the product and we wanted it to default to the option as checkbox checked, rather than the Magento default of forcing the user to choose an option. As the checkbox for a configurable product is filled in on the client side with javascript
this required some javascript code to checked the option and then reload the price. Here is the javascript we used to do this . This code we have to used or placed in the “view.phtml” file of the our skin.The path of the file is app/design/frontend/ [Package_name]/[Theme_name] /template/catalog/product/view.phtml file.

<script type="text/javascript">
var $j = jQuery.noConflict();
	// auto selects the first input with checkbox class
	$j('.options-list input.checkbox').attr('checked','checked');

By applying above code, default the custom option checkbox is checked and the price is updated according to the custom option price.
Hope this was helpful.

Speak Your Mind

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: