I would recommend apesia adding in variation check, it doesn't need to have the code itself for handling multiple variations, but at least if it is there (the check) the rest could be modularized.
Example:
Instead of having a base "stock level" --- store the stock level in a variation array (that only has one member) called "base" or "root".
Then if other members (or apesia) wants to later implement multiple stock levels, it will just be a matter of looping through the multiple variation arrays.
So with a basic item like a t-shirt, that might have sizes and colors: The stock level will be stored within the 2D array:
$variation0Num = 2; // how many loops to iterate/parse.
$variation1type = "size" // name of the variation
$variation1max = 3; // how many variations of type1
$variation2type = "color";
$variation2max = 3;
$stocklevel[0][0] = 1;
$stocklevel[0][1] = 2;
$stocklevel[0][2] = 3;
$stocklevel[1][0] = 2;
$stocklevel[1][1] = 3;
$stocklevel[1][2] = 4;
$stocklevel[2][0] = 1;
$stocklevel[2][1] = 2;
$stocklevel[2][2] = 3;
Items that have no variation, e.g. "base" or "root"
$variation0num = 1; // how many loops to iterate/parse.
$variation1type = "none"; // name of the variation.
$variation1max = 1; // how many variations of type 1.
$stocklevel[0] = 4;
At least if the check is there when adding stock (in the back end) and purchasing items (in the front end) it will make it easier for everyone involved to improve/add functionality - so that the code doesn't become fragmented with multiple implementations that are trying to solve the same thing.