• Resolved mrmartinimo

    (@mrmartinimo)


    Hi Kokomo

    first of all, I really like this plugin. Nice work!
    I updated the plugin from v2.5.3 to v2.6.3

    Sadly the product variations are not shown correctly.

    In v2.5.3 I got the title of the variant, but now I get a list of weird properties like this:
    _units:
    _delivery_time:
    _item_desc:
    _unit_price:

    With v2.6.3 I’m unable to see which variant was bought by the customer.

    For test reasons I replaced this part of ‘table-customer-list.php’

    <?php if( 'variable' == $product->get_type() ) {
      $item = $order->get_item($sale->order_item_id);
      ?>
    <td>
      <p>
    	  <?php 
    		  foreach($item->get_meta_data() as $itemvariation) {
    			  echo '<strong>' . wc_attribute_label($itemvariation->key) . '</strong>: &nbsp;' . wc_attribute_label($itemvariation->value) . '<br />';
    			}
    		?>
    	</p>
    </td>
    <?php } ?>

    with the version of 2.5.3

    <?php if( 'variable' == $product->get_type() ) {
      $variation = wc_get_product( wc_get_order_item_meta( $sale->order_item_id, '_variation_id', true) );
      $formatted_variation = wc_get_formatted_variation($variation, true);
      $item = $order->get_item($sale->order_item_id);
      ?>
      <td>
        <p>
          <?php
            if($formatted_variation) {
              echo $formatted_variation;
            } elseif($item) {
              foreach($item->get_formatted_meta_data() as $itemvariation) {
                echo strip_tags($itemvariation->display_key . ': &nbsp;' . $itemvariation->display_value) . '<br />';
              }
            } else {
              _e('Variation no longer exists', 'wc-product-customer-list');
            } ?>
        </p>
      </td>
    <?php } ?>

    What were the reasons for the changes?

    Best regards
    Moritz

    • This topic was modified 6 years, 9 months ago by mrmartinimo.
Viewing 1 replies (of 1 total)
  • Plugin Author Kokomo

    (@kokomoweb)

    Hi Moritz,

    From what I understand, how WooCommerce stores and displays these values is not consistant. With the old version, some users were reporting that the attributes were not displaying. If you have a solution for me I’d be very happy to hear it, this is the best I have found up to now ??

Viewing 1 replies (of 1 total)
  • The topic ‘Product variation is not shown correctly in table customer list’ is closed to new replies.