Hide QTY field in cart

11 replies [Last post]
Joined: 12/12/2007
Juice: 127

Is it possible to hide the QTY field in the cart view and make it a hidden field? All of our items would have a qty 1 so we don't want to confuse the customer.

TR
TR's picture
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3314

Uncheck the Qty. box at admin/store/settings/tables/uc_cart_view_table

<tr>.
Joined: 01/04/2008
Juice: 22

Hello,

This solution won't work well. If the customer were to click the add to cart button twice then the Quantity will be two but there will be no way for them to take it back to one, unless the customer removes the item from their cart. I smell a feature request here: ability to limit the number of times an item can be added to a cart.

Scott

TR
TR's picture
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3314

Well, that's a different question, isn't it? You can limit the quantity purchased by implementing hook_add_to_cart(). See http://www.ubercart.org/docs/api/hook_add_to_cart

<tr>.
Joined: 12/12/2007
Juice: 127

Thanks. We are handling the qty limiting using hook_add_to_cart so we should be OK but I will test.

Joined: 09/04/2007
Juice: 110

Hi. Maybe you could try this contrib in order to limit the quantity of items.

Joined: 03/05/2008
Juice: 47

Hi, am I wrong or this option is not available in Ubercart 2 (RC1) anymore?
Could anyone tell me how can I remove the Qty. field from the cart/ ?

Thanks in advance, G

I really like lemonade.
42droids.co.uk

Joined: 03/05/2008
Juice: 47

nobody? please.. Smiling

I really like lemonade.
42droids.co.uk

Joined: 01/23/2008
Juice: 241

I think that tapir interface went away in UC2, I have made this workaround for my project, in a custom module:

<?php

function mymodule_form_alter(&$form, $form_state, $form_id) {
  if (
$form_id == 'uc_cart_view_form') {
   
//This line disables qty column
   
unset($form['items']['#columns']['qty']);
   
//This loop denies access to all qty fields for the form
   
foreach($form['items'] as &$item)  {
      if (
is_array($item) & isset($item['qty'])) {
       
$item['qty']['#access'] = 0;       
      }
    }  
  }
}
?>
Joined: 03/05/2008
Juice: 47

Thank you, pcambra. I also got this workaround, but I thought there must be an "easy" way to do this. Via the admin area?
Anyway I think I can live with this... Smiling Thanks for your help again.

I really like lemonade.
42droids.co.uk

Joined: 03/27/2009
Juice: 426

What about this module:
http://drupal.org/project/uc_restrict_qty

Its limits purchases to only include one of a product (if specified).

Joined: 03/26/2009
Juice: 39

Yep thats an awesome mod. I just got it and it did the trick for me

THX