Custom discount calculation in template
-
Hi,
So I calculate the total savings of the order / cart like this (example for order):
foreach( $order->get_items() as $item_id => $item ) { $quantity = $item->get_quantity(); if ( $product instanceof WC_Product ) { $regular_price = $product->get_regular_price(); $sale_price = $product->get_sale_price(); if($product->is_on_sale()) { $savings += ($regular_price - $sale_price) * $quantity; } } } echo $savings;
Is it possible to get this to display in the pdf as well? I have looked at it but not sure if I can get the order / product object inside of the template. Before I lose my mind trying to get it to work.
Thanks in advance!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Custom discount calculation in template’ is closed to new replies.