Hello
You don’t need any code for 1st value.
Please, open >Setup Fields>Product Order Items and drag field “Order Line Subtotal” to export.
About 2nd value — what plugin do you use to create Units field?
Did you use this way https://docs.algolplus.com/algol_order_export/add-calculated-field-for-product/ ?
thanks, Alex
Thread Starter
Anonymous User 18057211
(@anonymized-18057211)
Hello, tks. i found the 1st value.
About the 2nd, yes i followed this exampl but i am getting the result as 0,
I need to multiply the number of items in a order product by its weight. Example:
Product A – Weight 0.150Kg
The customer purchased 10 items, so it would need to show the result of (10×0.150) = 1.5
Hello
please,
follow to https://docs.algolplus.com/algol_order_export/add-calculated-field-for-product/
add key “line_weight” and use this PHP code.
thanks, Alex
add_filter('woe_get_order_product_value_line_weight', function ($value, $order, $item, $product,$item_meta) {
if($product)
$value = $product->get_weight()*$item['qty'];
return $value;
}, 10, 5);
Thread Starter
Anonymous User 18057211
(@anonymized-18057211)
Hi again! Thanks, it worked!
Just one last question, when I export the list, the last item in the order does not appear and instead it is duplicating the second to last. See in the screenshot marked with yellow.
Screenshot – https://staging.efruteira.com.br/screenshot.JPG
How could I enter a code to sum the weight of all items in an order? The same way as the 2nd?
Tks a lot
please, use section >Setup Fields>Product Totals
Thread Starter
Anonymous User 18057211
(@anonymized-18057211)
HI! Tks a lot!
To show weight total per product i used:
add_filter('woe_get_order_product_value_product', function ($value, $order, $item, $product,$item_meta) {
return $item['unit_qty']*$item['unit_size'];
}, 10, 5);
And to show the item total cost using the plugin woo cost of goods i used this:
add_filter('woe_get_order_product_value_custo_total', function ($value, $order, $item, $product,$item_meta) {
return ($item['unit_qty']*$item['unit_size'])*$item['wc_cog_item_cost'];
}, 10, 5);
And to show total weight >Setup Fields>Product Totals using Total Items, because Total weight “total_weight_items” the sum was incorrect. Maybe a bug? I don’t know.
Again, tks a lot for your help.
-
This reply was modified 4 years, 2 months ago by
Anonymous User 18057211.
hello
Our field uses product weight.
So you should use this way to add ORDER field
https://docs.algolplus.com/algol_order_export/fields/
You must call $order->get_items() + use foreach
look at 1st example in section
https://docs.algolplus.com/algol_order_export/add-new-fields/
thans, Alex