Tags/topics: 
2
Answers
Vote up!
0
Vote down!

Remove "Update Cart" button or make the Quanity (Textbox) - READONLY

Hello,

In my case I dont like to allow my customer to be able to update the product quanity, because what I am selling is custom made designs, and each unique design is a quantity. Hence, I would like to make the quantity text box READONLY or make it a LABEL.

Even if possible, I would like to remove the UPDATE CART button.

Thanks

Asked by: dharam1987
on June 28, 2012

2 Answers

Vote up!
1
Vote down!

For example, hook_form_alter may help you.

/**
* Implements hook_form_alter().
*
* Hides `update cart` button and disables quantities in cart.
*/
function modulename_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id === 'views_form_commerce_cart_form_default') {
    $form['actions']['submit']['#access'] = FALSE;
    foreach($form['edit_quantity'] as &$quantity) {
      if (is_array($quantity)) {
        $quantity['#disabled'] = TRUE;
      }
    }
  }
}
Answer by: coder
Posted: Jul 1, 2012
Vote up!
-1
Vote down!

Hi

If we want to disable quantity on cart page for certain product ids or skus how can we acheive that?

Thanks
Faadz

Answer by: Faadz
Posted: Mar 2, 2016