Ubercart - fixing stock control and attributed items

Ubercart rocks. But it can be a sod to iron out some problems. One of these is when you break a product down into sub-types by attribute and then find that the stock control doesn't track them.

Ubercart tracks stock based on a unique product code (sku). If all your products come in one size or variant, then you're fine. If you need to supply a product in - say - different sizes and colours and manage the stock of each, then it gets more difficult.

Fortunately, there are some great modules available. Take a look at:

  • uc_multi_stock: Tracks and manages stock levels of attribute-based items.
  • uc_attribute_stock_filter: Watches the stock levels of attribute-based products and removes them from select lists as they go out of stock.

Install these and you're good to go.

Once you've added and installed, you can set up your product variants.

Setting up your products

The first thing to do is to set up the product attributes. Once that's done, go to any product that you want to make available in different options.

  1. Make your sizes or variants available in the 'options' tab of the product.
  2. Then create a unique sku for each under the 'adjustments' tab.
  3. Under the 'stock' tab, set the stock levels of the sub-products/variants.

Ubercart should now track stock for each, and remove the option to buy as they go out of stock.

As a bonus suggestion, if you need to offer different prices to different roles (eg: customer, retailer, wholesaler, member), check out uc_price_per_role.

Combined with role-based content access you can make the same storefront work for regular users and wholesale/discount buyers. 

Article posted Monday 23rd August 2010

Search