I'm using Ubercart 3.8 within Drupal 7.39.

I have products with attributes - one of those attributes is a sample item, I need a system that will only allow 3 instances of this attribute to be added to the cart at any given user session. That is either 3 instances of one product or a combination of any products - but no more than 3 can be added to the cart.

The attribute name remains a constant but the product name does not.

I need a solution which does not hack the ubercart or Drupal core as this would be counter-productive when it comes to module and core updates.

If the user tries to add more than 3 samples to the cart - a message should inform them that they can't add any more samples to the cart. This needs to work on the 'add to cart' button as well as the update button on the checkout page.

I have tried to use rules but cannot get the correct data selectors into the rule, also tried writing my own module to no avail :(.

$100 bounty for a working solution

Comments

Naurisr’s picture

I've sent you a module

Gixxernutter’s picture

Thanks Nauris, very happy with your solution.