Multiple Variations
Closed this issue · 3 comments
If there is more than one variation like this: http://esp.im/image/2o3E0Q2B2E1g
and this: http://esp.im/image/0D0F411P1C2J
The chart displays like this:
http://esp.im/image/3e1m1E3w3G3C
Is it possible to add the First variation (Black) then the second (small)
with a comma:
"Black, small"
I'll get into that!
It does work with normal product attributes (taxonomy), but apparently not with custom product attributes added at product level.
I've added some code to solve this problem. Only thing I'm not getting done is showing the pretty name, I'm only getting the sanitized value and it isn't saved in the database as a term.
My variations:
https://cloud.githubusercontent.com/assets/5774447/3794324/7298ae3a-1bab-11e4-8fb2-fcbaf03bf319.png
Using print_r( $variation['attributes'] );
https://cloud.githubusercontent.com/assets/5774447/3794323/72987e7e-1bab-11e4-94e6-c0982d75f054.png
With print_r( $product->get_variation_attributes() );
you do get the pretty name, but isn't useful for specific variations.
https://cloud.githubusercontent.com/assets/5774447/3794435/02ca438c-1bad-11e4-880c-dc6cacf9ec2d.png
As is now:
https://cloud.githubusercontent.com/assets/5774447/3794453/3756b6ee-1bad-11e4-8d2e-c8232236d808.png
Do you know a solid way to retrieve the pretty name?
PS. don't mind the colors..
The way you have it now works great!