Calculation
-
Hello,
We want a field that auto minuses –
Cart Discount
Cart Subtotal
Order Total
We have set up a new field called – _pos_discount-test
and written this code –add_filter('woe_get_order_product_value_pos_discount-test', function ($value, $order, $item, $product, $item_meta) { // Calculate the subtotal $subtotal = 0; foreach ($order->get_items() as $order_item) { $subtotal += $order_item->get_subtotal(); } $cart_discount = $order->get_discount_total(); $order_total = $order->get_total(); $custom_field_value = $subtotal - $cart_discount - $order_total; return $custom_field_value; }, 10, 5);
Can you help on why this isn’t showing anything please?
many thanks
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Calculation’ is closed to new replies.