# Basic Usage

# Add stock to an attribute

Adding stock to an attribute is almost exactly the same as adding stock to a product. Simply navigate to the product attribute you want to add stock to, e.g. Products > Attributes > T-Shirt Sizes > Medium, and set the stock fields accordingly:

  • Manage Stock? — Toggle stock management for this attribute term.
  • Stock quantity — Set the current quantity for this attribute term.

Edit attribute stock

Once stock has been enabled and set for the attribute, you can view it conveniently from the list of attribute terms.

View attribute stock in list

# Attribute-level stock

Stock can also be enabled and set at the product attribute level. That is, the stock quantity is not set per attribute term, but instead is set for the entire attribute. This is similar to product-level stock vs variation-level stock.

This type of stock is useful for when you need different amounts of stock to be deducted per attribute term. For example, if you sold Tea per grams, you could set your total Tea stock on an attribute Tea and add attribute terms such as 25g, 50g, 100g, etc. Each term can then be set to deduct the respective amount from the total Tea stock using the quantity multiplier option.

All you need to do to start tracking attribute stock for your products is to add the attributes to your products just like you normally would. Attribute stock can be added at the product level, or per variation by checking the Used for variations option.

Add attributes to product

All attributes with stock enabled will immediately start reducing stock when products are purchased. Cancelled and refunded orders will restore stock automatically, just as you'd expect with normal product stock.

Remember, attribute stock and product stock are separate types of stock. You can even use both types of stock on a product at the same time. However, it's common to manage your stock exclusively with attribute stock. In this case all you need to do is disable Manage stock and set Stock status to In stock on your products and variations.

Be sure to read How product stock limiting works for more info on this subject.

# Variations with "Any" attributes

Attribute stock fully supports variations that have "Any" selected for one or all of its attributes. This means you don't need to add multiple unnecessary variations to your products in order for attribute stock to function correctly.

There are however some edge cases with this. For example, some "Back in stock notifier" plugins save a specific variation ID to a customer's waitlist, but don't save the current selection of attributes. This means attribute stock has no way of matching the correct stock items. So it's important to make sure you test your products thoroughly when using variations this way.

# Product types

By default, all product types that can manage stock (e.g. simple and variable products) can make use of attribute stock.

Product types that cannot manage stock, such as grouped or external products, will not affect attribute stock even if the attribute has been assigned to the product.

Simple products will match attribute stock according to all assigned attributes, whereas variable products will match according to each variation's attributes individually. The exception to this is attributes that are not used for variations — these attributes will be used by all variations for matching.

TIP

Valid product types can be filtered per attribute stock from the advanced interface.

# Exclude products

If you don't want a particular product to make use of attribute stock, you can simply exclude it by enabling the Ignore attribute stock option:

Ignore attribute stock for product

Or per product variation:

Ignore attribute stock for variation

TIP

Setting Ignore attribute stock at the product level will exclude all variations, regardless of their individual setting.

# Product stock multipliers

In some cases you might want to just deduct different amounts of stock for a single product or variations of a product. To do this you don't even need to create global attributes or add stock to attributes. You can simply set a Stock multiplier directly on your product or variations.

Take a look at our demo product (opens new window) for an example of this.

Product variation stock multiplier

By default stock multipliers set on products will affect product stock quantities as well as any associated attribute stock quantities, if present. This can be changed with the Product stock multipliers setting.

# Site-wide settings

Attribute stock includes a few global settings for further control of your stock. You can find these settings under WooCommerce > Settings > Products > Inventory > Attribute stock.

Settings

  • Limit product stock — Auto / Everywhere / Disabled
    • When set to 'Auto', product stock will only be limited on the frontend, in cron tasks, and during certain actions. Setting 'Everywhere' will limit product stock in admin views, and may improve compatibility with other plugins.
  • Sync product visibility — Auto / Enabled / Disabled
    • Update visibility taxonomy for top-level products to reflect attribute stock status. This allows product queries to respect attribute stock, for example when using the "Hide out of stock items" setting. 'Auto' mirrors the "Hide out of stock items" setting.
  • Trigger product stock actions — Enabled / Disabled
    • Trigger product stock change actions when attribute stock changes. Many plugins require these actions to know when stock changes on your site. However, in some cases this might cause issues with certain plugins, or simply not be needed and use unnecessary system resources.
  • Allow backorders — Do not allow / Allow, but notify customer / Allow
    • Allow backorders for products using attribute stock, when product stock management is disabled. Does not affect products with stock management enabled, or products that are not using attribute stock.
  • Product stock multipliers — All stock / Product stock / Attribute stock
    • Select whether stock multipliers set on products and variations affect only product stock, only attribute stock, or both.
  • Out of stock variations — Out of stock / Greyed out / Hidden
    • Select how variation options will be displayed when out of stock. This only applies when the "Hide out of stock items" setting is disabled, and affects all variation options site-wide regardless of attribute stock. If you have a lot of variations you'll need to increase the "Ajax variation threshold" for this to work.
  • Unmatched "Any" variations — Visible / Out of stock / Greyed out / Hidden
    • Select how 'Any' variation options that don't match attribute stock will be displayed on the frontend. Only affects variations with 'Any' selected for some or all attribute terms.
  • Ajax variation threshold — Default: 30
    • Allows changing the default WooCommerce Ajax Variation Threshold value. When products have more than this number of variations, WooCommerce will load them via Ajax. This is often problematic as it incurs extra loading times and prevents hiding or disabling out-of-stock options. Most servers running WooCommerce can handle a value of at least 300.

# WooCommerce settings

In addition to the above settings, attribute stock will also respect all of the default WooCommerce inventory settings, such as Manage stock, Stock notifications, Stock thresholds, Out of stock visibility, and Stock display format.

# Shortcode

Sometimes it's useful to display attribute stock levels directly on arbitrary pages or areas of your site. To do this more easily we've included a simple shortcode that you can use. Usage is one of the following:

  • [attribute_stock id=123]
  • [attribute_stock sku="ABC123"]
  • [attribute_stock title="My Stock Item"]