Skip to content

"Any" Variations

"Any" variations is the name given to product variations that use one or more attributes without a specific attribute term selected.

These types of variations work a bit differently than regular "defined" variations in WooCommerce, and likewise with Attribute Stock.

What works?

The good news is that virtually all Attribute Stock functionality works with "any" variations out of the box, including attribute-based stock, stock images, and term multipliers.

This allows your product listings to stay simple while utilizing all of the advanced stock features available.

How does it work?

In order to make "any" variations work with attribute stock, we essentially need to output a blob of JavaScript on the frontend to expand "any" variations into "defined" variations for all possible combinations of attributes.

Why JavaScript? Because it's very fast at doing this type of thing.

In 99.9% of cases this works entirely seamlessly. But, there are some considerations...

Considerations

  • If a product's total combinations of attribute options is in the 10's of thousands, you might start to notice some slower initial load times while JavaScript does its thing. If this ever becomes an issue, try to reduce the number of "any" attributes on your product variations.

  • Since this uses JavaScript, it might not work on very customized themes or Gutenberg blocks that don't use the WooCommerce product page markup.

  • Keep in mind, while using "any" variations can simplify your product management, it's by no means a silver bullet. If you need to specify different prices, weights, or other details for each variation, then using "any" variations simply isn't an option.

What doesn't work?

The only thing we've encountered that definitively doesn't work for "any" variations using attribute stock is "back in stock notifier" / "waitlist" plugins.

This is because all of these plugins only store and monitor stock for the specific variation ID. But attribute stock needs to know the variation ID and the selected attribute term options, which these plugins don't save. Thus it's impossible to monitor stock for specific attribute terms with "any" variations.

The solution is to simply not use "any" variations and use defined variations instead. That way the variation ID is all that's needed to monitor stock levels.

If you find anything else that doesn't work with "any" variations, let us know.