FIX: allowPurcahse should check the VariationsStock level
Also included other 3.1 changes made by @nimeso