fix: tax_rate extraction in totals service (#156)

This commit is contained in:
Sebastian Rindom authored and GitHub committed 2021-01-27 18:55:05 +01:00
1 parent dc210c2cbd
commit 178d12fc71
1 file changed
+4 -1
+4 -1
View File
@@ -73,7 +73,10 @@ class TotalsService extends BaseService {
const shippingTotal = this.getShippingTotal(object) const shippingTotal = this.getShippingTotal(object)
const discountTotal = this.getDiscountTotal(object) const discountTotal = this.getDiscountTotal(object)
const giftCardTotal = this.getGiftCardTotal(object) const giftCardTotal = this.getGiftCardTotal(object)
const tax_rate = object.tax_rate || object.region.tax_rate const tax_rate =
typeof object.tax_rate !== "undefined"
? object.tax_rate
: object.region.tax_rate
return this.rounded( return this.rounded(
(subtotal - discountTotal - giftCardTotal + shippingTotal) * (subtotal - discountTotal - giftCardTotal + shippingTotal) *
(tax_rate / 100) (tax_rate / 100)