Instead of just changing the text of the add to cart button when a product is in the cart, there should be an option to disable the button so it cannot be clicked. Alternatively, the button could be changed to remove an item from the cart. This would be ideal for a website that offers digital downloads where it is not logical to purchase more than one of each product.

Comments

erik seifert’s picture

This thread is older but i want to say : Yes now it's possible to make such a feature.

What is to do

Make an module. ( Like uc_unique_sell )

Implement hook_add_to_cart

function uc_unique_sell_add_to_cart( $nid, $qty , $data )
{
    //check if in cart
   $cart = uc_cart_get_contents();
   foreach ( $cart as $item )
   {
          if ( $item->nid == $nid )
          {
                return array(array('success' => false, 'message' => t('You can only add 1 piece of each product to cart.'))) ;
          } 
   } 
  
}

Warning not tested

erik seifert’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.