How to Get Child Configurable product Super attribute value Magento 2?

You can retrieve the Children item used super attribute label value data from the child and parent product SKU of the configurable product.

This article is useful when you are programmatically adding a Configurable product to the cart. 

Let’s take an example, You need to fetch used super attribute value of the child item, native Magento sample data configurable product name, Cassius Sparring Tank has product SKU MT12 and its child product name Cassius Sparring Tank-XL-Blue has product SKU MT12-XL-Blue.

Cassius Sparring Tank-XL-Blue Children product has Size Attribute value is XL and Color Attribute Value is Blue. We need to retrieve this value dynamically by the Parent and child product Id/SKU to add Dynamic Configurable product to the cart.

Size attribute id is 194 and XL option id value is 5606
Color attribute id is 93 and Blue option id value is 5486

Call from the PHP class with a required argument to the function,

Output: