Add shipping amount to summary report
-
Hi,
We want to export orders based on products. It is all good, except that we struggle to find out how to add shipping cost to the same report.
Have tried to add a calculated field with Custom PHP code to modify output, without getting any output.
The report is per row; SKU/Product, quantity, amount (w and w/o tax+discount) and the last column should be total shipping cost per product.
Called it
my_custom_field
and the php code tried is:add_filter('woe_get_order_value_my_custom_field',function ($value,$order,$fieldname) {
if ( $order->has_shipping_method( 'pakkepost' ) ) {
foreach ( $order->get_shipping_methods() as $shipping_item_id => $shipping_item ) {
$point = wc_get_order_item_meta( $shipping_item_id, 'my_custom_field', true );
if ( ! empty( $point ) ) {
$value = $point;
}
}
}
return $value;
},10,3);Also, there is two different shipping methods that we use.
How to we get the output that we need?
- The topic ‘Add shipping amount to summary report’ is closed to new replies.