I am trying to submit custom add to cart on product page with configurable product options but i am getting error with that.My code looks like this :

 jQuery("#submit").click(function () {
var color = jQuery('#colors').val();
var qty = jQuery('#qty').val();;
var size = jQuery('#sizes').val();;
alert(window.location.href = '<?php echo Mage::getBaseUrl(); ?>checkout/cart/add?product=<?php echo $current_product_id; ?>&qty='+ qty + '&super_attribute[139]='+ size +'&super_attribute[141]='+ color+'');
 window.location.href = '<?php echo Mage::getBaseUrl(); ?>checkout/cart/add?product=<?php echo $current_product_id; ?>&qty='+ qty + '&super_attribute[139]='+ size +'&super_attribute[141]='+ color+'';

where 139 and 141 are the attributes ids.I am getting the error Please specify the product's option(s).what i am doing wrong ?


Pretty sure you would need to include the formkey in the add URL for this to work? e.g

e.g &form_key=<?php echo Mage::getSingleton('core/session')->getFormKey() ?>

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.