summaryrefslogtreecommitdiff
path: root/lib/super_good
diff options
context:
space:
mode:
authorNoah Silvera <noah@super.gd>2021-04-09 13:59:41 -0700
committerNoah Silvera <noah@super.gd>2021-04-13 08:45:30 -0700
commit351cd0a842afc664d02161ff9c6a8fc0186eae27 (patch)
tree0fea31e2865ea3abec9cdd607f6941852ac07dfa /lib/super_good
parenta5f76766988f529de8cd9dc568237fbcde2fc311 (diff)
Consider promotions in default shipping calculator
Previously, the shipment_total method on order was used, which does not take into account shipment promotions. Instead, we should manually sum the shipment cost taking into account any adjustments. Co-authored-by: Nick Van Doorn <nick@super.gd>
Diffstat (limited to 'lib/super_good')
-rw-r--r--lib/super_good/solidus_taxjar.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/super_good/solidus_taxjar.rb b/lib/super_good/solidus_taxjar.rb
index 36b5d85..a3cb730 100644
--- a/lib/super_good/solidus_taxjar.rb
+++ b/lib/super_good/solidus_taxjar.rb
@@ -44,7 +44,7 @@ module SuperGood
}
self.line_item_tax_label_maker = ->(taxjar_line_item, spree_line_item) { "Sales Tax" }
self.logging_enabled = false
- self.shipping_calculator = ->(order) { order.shipment_total }
+ self.shipping_calculator = ->(order) { order.shipments.sum(&:total_before_tax) }
self.shipping_tax_label_maker = ->(shipment, shipping_tax) { "Sales Tax" }
self.taxable_address_check = ->(address) { true }
self.taxable_order_check = ->(order) { true }