From 3fbb98519d9929c1a09c81fc35539a208bc6ea3a Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Tue, 2 Oct 2018 17:47:15 +0100 Subject: [PATCH] Adapt tax_rate_decorator to new spree version. Spree's default tax calculator now is checking line_items tax category, not the product tax category. See Spree's change here: https://github.com/spree/spree/commit/a0a4b91f13d7cfae2528e08c1c5005618d34fc16#diff-46e557ca8717d6ab5039470a40d00ea8 --- app/models/spree/tax_rate_decorator.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/spree/tax_rate_decorator.rb b/app/models/spree/tax_rate_decorator.rb index fd111084ce..652fb5b62b 100644 --- a/app/models/spree/tax_rate_decorator.rb +++ b/app/models/spree/tax_rate_decorator.rb @@ -25,9 +25,8 @@ module Spree # LineItems or Orders, so we mock out a line item here to fit the interface # that our calculator (usually DefaultTax) expects. def compute_tax(amount) - product = OpenStruct.new tax_category: tax_category line_item = LineItem.new quantity: 1 - line_item.define_singleton_method(:product) { product } + line_item.tax_category = tax_category line_item.define_singleton_method(:price) { amount } # Tax on adjustments (represented by the included_tax field) is always inclusive of