Needs work
Project:
Commerce Kustom Checkout (formerly Klarna Checkout)
Version:
8.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Reporter:
Created:
20 May 2020 at 12:53 UTC
Updated:
8 Dec 2020 at 11:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
ozinComment #3
jsacksick commentedWhy do you have a NULL tax rate in the first place?
Comment #4
jsacksick commentedDid you define a custom tax type plugin? cause the LocalTaxTypeBase has this code:
Are you using the Avatax module by any chance? We should fix this, I realized we're not setting the "percentage" when adding the adjustment:
Comment #5
ozinHi
No, I do not use Avatax module. Probably I miss somewhere `percentage` when creating Tax, or maybe when it is should be Zero percent it set NULL, not sure. I will debug my case and back with more details.
Comment #6
ozinUpdated patch according to lates changes
Comment #7
jsacksick commentedShouldn't we try calculating the percentage? Klarna doesn't complain about a "0" tax rate? Is the tax amount 0 as well?
Comment #8
jsacksick commentedSee https://www.drupal.org/project/commerce_avatax/issues/3138492#comment-13....
Comment #9
jsacksick commentedI'm pretty sure Klarna will crash if we pass a 0 tax_rate (in case a tax amount is positive), so I believe the proper fix is to make sure the tax adjustment has a percentage set on the tax adjustment, or the percentage should be calculated, so not committing this.
Comment #10
ozinI think this issue is more related to my project, so I have to debug more.
Comment #11
zaporylieI've just stepped-into step-debugging mode to learn more about this issue and I believe this is related to how Adjustments are handled in general, meaning it may actually be an issue in commerce core.
from Drupal\commerce_order\Adjustment.php:
So if the tax rate resolves to "0" (which is valid tax rate in some tax zones) the code above will result in Adjustment::percentage member property set to NULL, causing the fatal error in question. However, IMHO this is to be solved in Commerce Core rather than here.
Comment #12
zaporylieCreated #3187199: Adjustment percentage member property cannot be set to 0