In Woocommerce I have these attributes and the terms for them:
color: blue(description=1), red(description=2)
size: xl(description=10), m(description=20)
All terms have description fields mentioned above.
For a variable product, I have these variations:
blue-m
red-xl
For the purpose of auto-generating the variations SKU (based on those descriptions) I need to get the description for the attribute term used in each variant (we use different attributes for each variable product).
For example for the variation with red
color and xl
size, I want to get something like 210
(from descriptions of red
and xl
)
I tried using $variation['attributes']
and removing extra characters from it to use with get_terms
to get the descriptions of the attributes used in a variant, but I couldn't succeed.
Any Idea?