Skip to content

Commit

Permalink
Apply tax on discounted price
Browse files Browse the repository at this point in the history
  • Loading branch information
cyu committed Jan 19, 2017
1 parent 34f0279 commit 842f377
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/spree/line_item_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Spree::LineItem.class_eval do
def tax_cloud_cache_key
key = "Spree::LineItem #{id}: #{quantity}x<#{variant.cache_key}>@#{price}#{currency}"
key = "Spree::LineItem #{id}: #{quantity}x<#{variant.cache_key}>@#{price}#{currency}promo_total<#{promo_total}>"
if order.ship_address
key << "shipped_to<#{order.ship_address.try(:cache_key)}>"
elsif order.bill_address
Expand Down
2 changes: 1 addition & 1 deletion app/models/spree/tax_cloud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def self.cart_item_from_item(item, index)
index: index,
item_id: item.try(:variant).try(:sku).present? ? item.try(:variant).try(:sku) : "LineItem #{item.id}",
tic: (item.product.tax_cloud_tic || Spree::Config.taxcloud_default_product_tic),
price: item.price,
price: item.quantity == 0 ? item.price : (item.promo_total / item.quantity) + item.price,
quantity: item.quantity
)
when Spree::Shipment
Expand Down

0 comments on commit 842f377

Please sign in to comment.