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

    (@algolplus)

    Hello

    How will you add it to order line ? Could you upload sample file to helpdesk ?

    if you’re a programmer, you can modify example “export Shipping line as Product”
    https://algolplus.com/plugins/code-samples/
    You must replace $order->get_items(‘shipping’) with $order->get_items(‘fee’)

    if you want to export only taxes , try example “add all taxes as columns”

    I can’t help you until you provide sample file.
    thanks, alex

    Thread Starter eVersatile

    (@eversatile)

    I’ve tried modifying the sample codes, but I don’t think it’s quite what I’m looking for…
    I have opened a ticket ‘#38’ in the HelpDesk and attached 2 images, showing asample of what I’d like to export.
    It’s basically another the id of the field would be ‘order_fee_ine_items’ with class ‘fee’.

    Plugin Author algol.plus

    (@algolplus)

    Thank you for detailed reply!

    Could you try this code ?

    add_filter('woe_get_order_fields', function ($fields) {
    	$fields['processing_fee'] = array( 'label' => 'Processing Fee', 'colname' => 'Processing Fee', 'checked' => 1 );
    	return $fields;
    });
    
    add_filter('woe_get_order_value_processing_fee', function ($value,$order) {
    	$fees = $order->get_items('fee');
    	if( !$fees )
    		return 0;
    	$fee = reset($fees); // take first 
    	return $fee['line_total'];
    },10, 2);
    
    Thread Starter eVersatile

    (@eversatile)

    Excellent.
    That code snippet did accomplish the task.
    Thank you for your help, and enjoy your day.

    Plugin Author algol.plus

    (@algolplus)

    you’re welcome.

    good luck!

    Plugin Author algol.plus

    (@algolplus)

    This code was added to code samples

     // new column "All Fees"
    add_filter('woe_get_order_fields', function ($fields) {
    	$fields['all_fees'] = array( 'label' => 'All Fees', 'colname' => 'All Fees', 'checked' => 1 );
    	return $fields;
    });
    add_filter('woe_get_order_value_all_fees', function ($value,$order) {
    	$result = 0; 	
    	foreach($order->get_items('fee') as $fee) {
    		$result += $fee['line_total'];
    	}
    	return $result;
    },10, 2);
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Add Custom Field’ is closed to new replies.