1

Using the Commerce Kickstart distribution I have a shop site listing products. The product page shows a Quantity widget to allow the buyer to choose the product quantity to be added to the cart. (look my capture)

I need to change this widget to the standar select list html element. (look the capture)

Update: I found the library which generate this "spinner", is located at: profiles/commerce_kickstart/libraries/jquery_ui_spinner I don't see any module related to this. Maybe in theme?

enter image description here

0

I know its already a year ago, but if someone bump in this question here's one of the solution, I don't know if there's a module that already existing changing the widget type of quantity in add to cart form but you can achieve this using hook_form_commerce_cart_add_to_cart_form_alter like this

Example:

function example_form_commerce_cart_add_to_cart_form_alter(&$form, &$form_state) {
  // Change widget type of quantity to select list
  $form['quantity'] = array(
    '#title' => t('Quantity'),
    '#type' => 'select',
    '#datatype' => 'integer', // <-- I added this one to fix Notice: Undefined index: #datatype in commerce_cart_add_to_cart_form_validate() when you click add to cart button
    '#options' => array(
      1 => '1',
      2 => '2',
      3 => '3',
      4 => '4',
      5 => '5'
    )
  );
}

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.