1

Specs: Magento 2.1.7

I got an issue and could not find anything similar to my case on the google.

I have a tax price rule that makes free shipping when subtotal is above 500 euros. Rule is working fine, free shipping is being applied without problems. Problem comes with products that have FPT (Fixed product tax) applied.

When free shipping is applied, tax amount from the totals turns into a nice round zero. Tax amount reduced to the zero.

Apparently this isn't happening with products that are using tax classes. Shipping becomes free and taxes looks fine.

I'm out of the ideas, going to dive into the code, but I'm not sure if I will find the problem. Thanks for any help.

Macas
  • 560
  • 3
  • 22

1 Answers1

0

Apparently FPT doesn't sum up with totals, they have a different total item.

After knowing that I have wrote an observer which adds FPT amount to the tax total and everything looks fine now.

**Event** sales_quote_address_collect_totals_after



/**
 * Adds Fixed Product Tax(FPT) to the total Taxes
 */
public function execute(Observer $observer)
{
    /** @var Magento\Quote\Model\Quote\Address\Total */
    $total = $observer->getData('total');

    /* Adds FPT to the tax totals even if it is equal to zero */
    $total->addTotalAmount('tax', $total->getWeeeAmount());

    return $this;
}
Macas
  • 560
  • 3
  • 22