Product variation is not shown correctly in table customer list
-
Hi Kokomo
first of all, I really like this plugin. Nice work!
I updated the plugin from v2.5.3 to v2.6.3Sadly 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>: ' . 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 . ': ' . $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
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Product variation is not shown correctly in table customer list’ is closed to new replies.