Item Cost – issue
-
Hello.
For accounting purposes, i need the sale price of each sold product, before discounts. I tried with the field “Item Cost” but is showing the cost/price with discounts applied. Is there any field working in this way?
Thank you in advance.
-
Hello
Could you try field “Order Line Subtotal” ?
section >Setup Fields>Product Itemsthanks, Alex
Hello.
Unfortunately, this is for total items and we need the cost of “each item”, before discounts. Any workaround?
Thanks again.
Hello
you can add this code to “Misc Settings” to divide subtotal amount.
thanks, Alexadd_filter('woe_get_order_product_value_line_subtotal', function ($value, $order, $item, $product,$Item_meta) { return $value/$item['qty']; }, 10, 5);please, follow to https://algolplus.freshdesk.com/support/solutions/articles/25000018287-add-calculated-field-for-product-
use meta key “item_cost_raw” and this PHP code
thanks, Alexadd_filter('woe_get_order_product_value_item_cost_raw', function ($value, $order, $item, $product,$item_meta) { return $item->get_subtotal()/$item['qty']; }, 10, 5);It worked like a charm! Thanks mate.
One extra thing: how can i get the “Order Total Amount” but without fees? Only with discounts applied.Thanks again.
please, follow to https://algolplus.freshdesk.com/support/solutions/articles/25000016635-add-calculated-field-for-order-
use meta key “total_no_fee” and this code
add_filter('woe_get_order_value_total_no_fee',function ($value, $order,$fieldname) { $fee_total = 0; foreach( $order->get_items('fee') as $item_id => $item_fee ){ $fee_total += $item_fee->get_total(); } return $order->get_total() - $fee_total ; },10,3);Warning: amount includes shipping cost.
-
This reply was modified 6 years, 4 months ago by
algol.plus.
Thanks, your solution worked great. I have another question: how can we round Order Total Fee value? Is there any option to round values before export?
Thanks again!hello
please, open section “Misc Settings” and mark “Format numbers”
thanks, AlexHello mate.
Unfortunately, it didn’t work; we got ,00 at the end of all values.
We already fixed total_no_fee in this way:add_filter('woe_get_order_value_total_no_fee',function ($value, $order,$fieldname) { $fee_total = 0; foreach( $order->get_items('fee') as $item_id => $item_fee ){ $fee_total += $item_fee->get_total(); } return $order->get_total() - round($fee_total, 0) ; },10,3);How can we do the same but with order_total_fee?
Thank you in advance.
Regards.I’m not sure if you are getting notifications of this topic because it’s resolved @algolplus
Please, check the message above. Thanks.Some details about hooks
https://algolplus.com/plugins/documentation-order-export-woocommerce/+ a lot of examples https://algolplus.com/plugins/code-samples/
please, try this code
add_filter('woe_get_order_value_order_total_fee',function( $value,$order, $fieldname ) { return round($value); }, 10, 3 ); -
This reply was modified 6 years, 4 months ago by
The topic ‘Item Cost – issue’ is closed to new replies.