title: How to get Attributes of a associated child product(saleable) in magento2
body: <p>As  shown in below image a configurable product has only one associated product that is in stock. I want to get only those attributes of this simple product from which its associated with parent product.</p>
  
  <p><a href="https://i.stack.imgur.com/BxwlT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BxwlT.png" alt="enter image description here"></a>  </p>
  
  <p>I am not sure it is correct whatever I tried is below-</p>
  
  <pre><code>$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
   $product = $objectManager-&gt;create('Magento\Catalog\Model\Product')-&gt;load(6);  // 6 is product id of configurable product.
  
  $_children = $product-&gt;getTypeInstance()-&gt;getUsedProducts($product);
      foreach ($_children as $child){
          foreach ($child-&gt;getAttributes() as $attribute) {
                  echo $attrCode = $attribute-&gt;getAttributeCode();
  
              }
      }
  </code></pre>
  
  <p>this $attrcode prints all attributes whether want to get only super attributes as shown in above image. </p>