WooCommerce PDF Invoices & Packing Slips, for pro templates, by Ewout Fernhout

Compatibility with WooCommerce PDF Invoices & Packing Slips Pro Templates by Ewout Fernhout.

//For line item
add_filter('wpo_wcpdf_templates_item_column_data', function ($column, $column_setting, $line_item, $document){
    if(isset($column_setting['type']) && $column_setting['type'] == 'price'){
        if(isset($column_setting['price_type']) && $column_setting['price_type'] == 'total'){
            $order = $document->order;
            $order_items = $order->get_items();
            if(isset($line_item['item_id'])){
                $item_id = $line_item['item_id'];
                $item = $order_items[$item_id];
                $you_saved_text = '';
                $column['data'] .= apply_filters('advanced_woo_discount_rules_get_order_line_item_you_saved_text', $you_saved_text, $item, $order);
            }
        }
    }
    return $column;
}, 10, 4);

//For Grand total
add_filter('wpo_wcpdf_templates_totals', function ($totals_data, $type, $document){
    if(is_array($totals_data) && !empty($totals_data)){
        foreach ($totals_data as $key => $totals){
            if(isset($totals['type']) && $totals['type'] == 'total'){
                if(isset($totals['class']) && $totals['class'] == 'total grand-total'){
                    $order = $document->order;
                    $you_saved_text = '';
                    $totals_data[$key]['value'] .= apply_filters('advanced_woo_discount_rules_get_order_total_you_saved_text', $you_saved_text, $order);
                }

            }
        }
    }

    return $totals_data;
}, 10, 3);