• Resolved baudouin88

    (@baudouin88)


    When I export the orders, I have one row for each products purchased under that order ID.
    Exemple:

    #2773 | 11/2/17 14:03 | john | smith | productA
    #2773 | 11/2/17 14:03 | john | smith | productB
    #2773 | 11/2/17 14:03 | john | smith | productC

    I could I have this instead?

    #2773 | 11/2/17 14:03 | john | smith | productA,productB, productC

    Thank you for the good work,

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author algol.plus

    (@algolplus)

    Hello

    Could you try this code ?
    thanks, Alex

    // add field  "list of products"
    add_filter('woe_get_order_fields', function ($fields) {
    	$fields['products_list'] = array( 'label' => 'Products List', 'colname' => 'Products List', 'checked' => 1 );
    	return $fields;
    });
    // calculate  new field
    add_filter('woe_get_order_value_products_list', function ($value,$order, $field) {
    	$products = array();
    	foreach($order->get_items('line_item') as $item)
    		$products[] = $item['name'];
    	return join(", ", $products);
    }, 10, 3);
    Thread Starter baudouin88

    (@baudouin88)

    So this one and with a little trick (remove “products” and “item cost”) totally worked for me.

    Awesome I really appreciate, and I got to understand how to make my own filters, you’r the man

    Concerning my other request on “Total order per customer” topic, where I asked the filter for “same code for the number of orders per company”; Well this one didn’t work (I’ll notify in the correct section), the plugin fail to perform any exportation.

    Plugin Author algol.plus

    (@algolplus)

    you’re welcome.
    I’ve replied to another topic too.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘3 row for each products of an order?’ is closed to new replies.