0

I am using opencart version 2.1.0.1.

I want to set different tax values to products for different countries. It's ok but when i want to give tax a negative value, it doesn't works.

Is this possible to use negative value on taxes by changing the code? I want to apply some discounts by tax. Please help.

Tax.php like this:

<?php
class ModelTotalTax extends Model {
    public function getTotal(&$total_data, &$total, &$taxes) {
        foreach ($taxes as $key => $value) {
            if ($value > 0) {
                $total_data[] = array(
                    'code'       => 'tax',
                    'title'      => $this->tax->getRateName($key),
                    'value'      => $value,
                    'sort_order' => $this->config->get('tax_sort_order')
                );

                $total += $value;
            }
        }
    }
}
Alen
  • 21
  • 1
  • 6

1 Answers1

0

What's the error when you add - values from the admin panel?

You can also duplicate the tax module (don't forget to change class ModelTotalTax to something else in your new module, like class ModelTotalDuplicated) and edit the code, specifically this line you'd want to change (in your duplicated module):

$total += $value;

to

$total -= $value;
necrodeus
  • 134
  • 1
  • 12