WooCommerce – Fixed quantity of a product [closed]

You might want to reconsider your approach here, at first glance it seems to me that you could greatly simplify this but using a hook after the order is processed.

If all of your variations are really only quantities then it stands to reason that when an order is completed you’d update the quantities for the parent and each of the variations so that they all reflect the same inventory count.

So when processing the order you have parent ID and the variation IDs within the $product and you can simply update the quantity values for each within the loop.

I don’t know the right hook off the top of my head but you can find the WooCommerce docs at http://wcdocs.woothemes.com/apidocs/index.html and http://wcdocs.woothemes.com/codex/extending/hooks/