• Resolved malasaad82

    (@malasaad82)


    Hi,
    Is it possible to create custom column to print specific product with its quantity.

    Order | Product1 |?Product2 | ...
    #1231        5          3
    • This topic was modified 6 years, 10 months ago by malasaad82.
    • This topic was modified 6 years, 10 months ago by malasaad82.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author algol.plus

    (@algolplus)

    Thread Starter malasaad82

    (@malasaad82)

    Hi Alex,
    Thank you for your answer, I have tried change your code for cod and its like this: but not sure how to do that with more than one product. should I repeat all for each one?

    add_filter('woe_get_order_value_cod_super', function ($value,$order,$field) {
    	$get_order = wc_get_order( $order->id );
    	$items = $get_order->get_items();
    	foreach ( $items as $item ) {
    		if('2675' == $item->get_product_id()){
    			return $item->get_quantity();
    		}
    	}	
    },10, 3);
    add_filter('woe_get_order_fields', function ($fields) {
    	//add to field list
    	$fields['cod_super'] = array( 'label' => 'Product Super', 'colname' => 'Product Super', 'checked' => 1 );
    	return $fields;
    });
    Plugin Author algol.plus

    (@algolplus)

    hi

    Please, visit my link and find this code .
    It will add necessary columns automatically.

    class Woe_Product_Columns {
    ....
    }
    new Woe_Product_Columns();
    • This reply was modified 6 years, 10 months ago by algol.plus.
    Thread Starter malasaad82

    (@malasaad82)

    Thank you

    Plugin Author algol.plus

    (@algolplus)

    you’re welcome.

    Plugin Author algol.plus

    (@algolplus)

    the question was added to FAQ

    • This reply was modified 6 years, 9 months ago by algol.plus.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Product name as column’ is closed to new replies.