The Shop is selling framed images. The customer can chose frame material and dimensions (list of preset Width x Height combinations). Both – frame material and dimensions are configured as predefined Attribute Lists. For Dimensions only some very specific Width x Height combinations are available. See Example:
Then the option Create variations from all attributes is used to have WooCommerce generate every possible combination of these variations. So we end up with a list like this:
The critical Point is, that now we need the 2 standard meta fields Width & Height for every variation to be filled in some way automatically based on the selected Dimension custom Attribute. Like this:
So basically (no real code):
if (selected Dimensions Attribute is "30 x 20 cm") set meta $width = 30 & meta $height = 20
if (selected Dimensions Attribute is "45 x 30 cm") set meta $width = 45 & meta $height = 30
if (selected Dimensions Attribute is "60 x 40 cm") set meta $width = 60 & meta $height = 40
etc.
It would be enough if this happens, when the variable product is saved/updated. The solution can be pretty simplistic, since the Attribute List for Dimensions is predefined.
I know this might be a somewhat special case, but I think the needed functionality might be of interest for others too.
Can anyone help?