title: Get WooCommerce product attributes from complete order?
body: <p>I am working on a small plugin for WooCommerce that will allow me to create a URL from an object to link to a certain page. That page will take into account the PHP GET variables and generate a technical drawing. In my theme's <em>"admin-new-order.php"</em> page, I have added the following code just above where the email's order table is generated:</p>
  
  <pre><code>$ordered_items = $order-&gt;get_items();
  foreach ( $ordered_items as $item ) {
  $product_name = $item['name'];
      $product_id = $item['product_id'];
      $product_variation_id = $item['variation_id'];
  
      if($product_id == "1388")
      {
          if ($product_variation_id) { 
          $product = wc_get_product( $item['variation_id'] );
          var_dump($product-&gt;get_attributes());
          // Get the attributes
          // Process the attributes
          // Create URL 
          // Echo URL
          }
      }
  
  }
  </code></pre>
  
  <p>If I put an echo into the above then it appears in the right place of the email, so I know the code is executing as expected.</p>
  
  <p>The links will be generated only by product with id "1388", which also executes as expected in testing. Product id "1388" is a variable product where the customer can select material, shape etc. and also I am using the Measurement Price Calculator plugin so the user can set their required size. </p>
  
  <p>The problem lies within the line that says </p>
  
  <pre><code>echo $product-&gt;get_attributes();
  </code></pre>
  
  <p>When this line of code is present, I get an internal server error when trying to make an order and the order won't go through. </p>
  
  <p>I am trying to get the selected attributes from out of the product so I can splice them up and generate a URL to take you to a page that will generate a technical drawing. I know it's possible because the table in the email contains the set attributes but I can't seem to find where and how WooCommerce does this.</p>
  
  <p>A push in the right direction would be greatly appreciated, thank you. </p>
  
  <p>EDIT: As Reigel suggested, I have amended the following code in my block:</p>
  
  <pre><code>    $product = wc_get_product( $item['variation_id'] );
      var_dump($product-&gt;get_attributes());
  </code></pre>
  
  <p>A var_dump of this produces this for example:</p>
  
  <pre><code>{ ["material"]=&gt; array(6) { ["name"]=&gt; string(8) "Material" ["value"]=&gt; string(15) "Steel | Plastic" ["position"]=&gt; string(1) "0" ["is_visible"]=&gt; int(1) ["is_variation"]=&gt; int(1) ["is_taxonomy"]=&gt; int(0) }
  </code></pre>
  
  <p>As you can see, the material value is "Steel | Plastic", I chose Steel in the order here so I'd like to get that value, ie. the one the user selected</p>