I know that I can create attributes of color, size and etc. But for some reason, I had to combine 3 attributes into one and then displayed them differently.
Now, I've the attribute with the values :
pa_mixed : Red, Blue, Green, S, M, L, Children, Adult
But on the front end I have to display like :
Colors : Blue, Red
Size : M
Aged : Children
So far I have tried :
if (!empty ($product->get_attribute('pa_mixed'))):
$pa_mixed = $product->get_attribute('pa_mixed');
else:
$pa_mixed = "";
endif;
$size = array('S','M','L');
if ( in_array( $size, $pa_mixed ) ) {
//colors attributes
}
//etc
And finally I got lost
please help me to find the right way, thank you
Updated (handling fewer attribute classified types)
Try the following, that will display product attributes, classified by type, in single product pages, below the short description:
Code goes in functions.php file of your child theme (or in a plugin). Tested and work.
Based on this attributes, product settings:
I get the following display on a product (single product page):