Skip to content

Commit 842f377

Browse files
committed
Apply tax on discounted price
1 parent 34f0279 commit 842f377

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

app/models/spree/line_item_decorator.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Spree::LineItem.class_eval do
22
def tax_cloud_cache_key
3-
key = "Spree::LineItem #{id}: #{quantity}x<#{variant.cache_key}>@#{price}#{currency}"
3+
key = "Spree::LineItem #{id}: #{quantity}x<#{variant.cache_key}>@#{price}#{currency}promo_total<#{promo_total}>"
44
if order.ship_address
55
key << "shipped_to<#{order.ship_address.try(:cache_key)}>"
66
elsif order.bill_address

app/models/spree/tax_cloud.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def self.cart_item_from_item(item, index)
4848
index: index,
4949
item_id: item.try(:variant).try(:sku).present? ? item.try(:variant).try(:sku) : "LineItem #{item.id}",
5050
tic: (item.product.tax_cloud_tic || Spree::Config.taxcloud_default_product_tic),
51-
price: item.price,
51+
price: item.quantity == 0 ? item.price : (item.promo_total / item.quantity) + item.price,
5252
quantity: item.quantity
5353
)
5454
when Spree::Shipment

0 commit comments

Comments
 (0)