You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on tax app it became apparent that taxes and discounts are applied incorrectly when compared to the Avatax plugin. discounts field is returned when, according to the documentation, shouldn't.
Voucher types with the issue:
ENTIRE_ORDER voucher with applyOncePerOrder: true (cheapest item)
SPECIFIC_PRODUCT
Steps to reproduce the problem
Subscription query:
subscription CalculateTaxes {
event {
...CalculateTaxesEvent
}
}
fragment CalculateTaxesEvent on Event {
__typename
... on CalculateTaxes {
taxBase {
...TaxBase
}
...
}
}
fragment TaxBase on TaxableObject {
...
discounts {
...TaxDiscount
}
...
lines {
...TaxBaseLine
}
sourceObject {
__typename
... on Checkout {
...
}
... on Order {
...
}
}
}
fragment TaxDiscount on TaxableObjectDiscount {
name
amount {
amount
}
}
fragment TaxBaseLine on TaxableObjectLine {
sourceLine {
__typename
... on CheckoutLine {
id
checkoutProductVariant: variant {
id
product {
taxClass {
id
name
}
}
}
undiscountedTotalPrice {
amount
}
}
... on OrderLine {
id
orderProductVariant: variant {
id
product {
taxClass {
id
name
}
}
}
undiscountedTotalPrice {
net {
amount
}
}
}
}
quantity
unitPrice {
amount
}
totalPrice {
amount
}
}
Issue 1
Create a voucher with either "Fixed amount" or "Percentage"
Set applyOncePerOrder to true
Create a checkout with few products that have different prices
Trigger checkout taxes webhook with discounts query
Current result: discounts field contains the discount applied to the cheapest item AND the cheapest line is discounted.
Issue 2
Create a voucher with either "Fixed amount" or "Percentage"
Set it to a specific product
Create a checkout with the product
Trigger checkout taxes webhook with discounts query
Current result: discounts field contains the discount applied to the specific product AND the specific product line is discounted (totalPrice and unitPrice is reduced).
What did you expect to happen?
Issue 1:
Expected result:
Per documentation:
`discounts` - List of discounts assigned to checkout. (Those discounts should be applied by a tax App.)
The discounts field should be empty because the discount is already applied. The line should be still have discounted price.
Issue 2:
Expected result:
Per documentation:
`discounts` - List of discounts assigned to checkout. (Those discounts should be applied by a tax App.)
The discounts field should be empty because the discount is already applied. The line should be still have discounted price.
Expectation:
discounts should only contain the discount when the voucher is of type ENTIRE_ORDER and the discount is not applied to lines by Saleor.
Alternative solution:
If discounts field is the expected behaviour when above mentioned vouchers are applied then docs should be updated and TaxableObjectDiscount should have additional field type so that the app can calculate taxes and discounts properly without having to apply additional HANDLE_DISCOUNTS permission. Alternatively, voucher field in CheckoutLine and OrderLine should be able to be queried without the permission.
Logs
No response
Environment
Saleor version: v3.18, v3.20
OS and version: …
The text was updated successfully, but these errors were encountered:
What are you trying to achieve?
While working on tax app it became apparent that taxes and discounts are applied incorrectly when compared to the Avatax plugin.
discounts
field is returned when, according to the documentation, shouldn't.Voucher types with the issue:
ENTIRE_ORDER
voucher withapplyOncePerOrder: true
(cheapest item)SPECIFIC_PRODUCT
Steps to reproduce the problem
Subscription query:
Issue 1
applyOncePerOrder
totrue
discounts
queryCurrent result:
discounts
field contains the discount applied to the cheapest item AND the cheapest line is discounted.Issue 2
discounts
queryCurrent result:
discounts
field contains the discount applied to the specific product AND the specific product line is discounted (totalPrice
andunitPrice
is reduced).What did you expect to happen?
Issue 1:
Expected result:
Per documentation:
The
discounts
field should be empty because the discount is already applied. The line should be still have discounted price.Issue 2:
Expected result:
Per documentation:
The
discounts
field should be empty because the discount is already applied. The line should be still have discounted price.Expectation:
discounts
should only contain the discount when the voucher is of typeENTIRE_ORDER
and the discount is not applied to lines by Saleor.Alternative solution:
If
discounts
field is the expected behaviour when above mentioned vouchers are applied then docs should be updated andTaxableObjectDiscount
should have additional fieldtype
so that the app can calculate taxes and discounts properly without having to apply additionalHANDLE_DISCOUNTS
permission. Alternatively,voucher
field inCheckoutLine
andOrderLine
should be able to be queried without the permission.Logs
No response
Environment
Saleor version: v3.18, v3.20
OS and version: …
The text was updated successfully, but these errors were encountered: