Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Add LineItem#display_pre_tax_amount and expose it in API v2

Damian Legawiec0f44ccafb2a8
diff --git a/api/app/serializers/spree/v2/storefront/line_item_serializer.rb b/api/app/serializers/spree/v2/storefront/line_item_serializer.rb
index 0683ae3385..12b7f2a073 100644
--- a/api/app/serializers/spree/v2/storefront/line_item_serializer.rb
+++ b/api/app/serializers/spree/v2/storefront/line_item_serializer.rb
@@ -9,7 +9,8 @@ module Spree
:display_adjustment_total, :additional_tax_total,
:discounted_amount, :display_discounted_amount,
:display_additional_tax_total, :promo_total, :display_promo_total,
- :included_tax_total, :display_included_tax_total
+ :included_tax_total, :display_included_tax_total,
+ :pre_tax_amount, :display_pre_tax_amount
belongs_to :variant
end
diff --git a/api/docs/v2/storefront/index.yaml b/api/docs/v2/storefront/index.yaml
index d07a26e798..700cd21cea 100644
--- a/api/docs/v2/storefront/index.yaml
+++ b/api/docs/v2/storefront/index.yaml
@@ -1671,6 +1671,12 @@ components:
display_discounted_amount:
type: string
example: '$125.00'
+ pre_tax_amount:
+ type: string
+ example: '125.0'
+ display_pre_tax_amount:
+ type: string
+ example: '$125.00'
promo_total:
type: string
example: '-5.0'
diff --git a/core/app/models/spree/line_item.rb b/core/app/models/spree/line_item.rb
index 5c14515789..8a2ee06777 100644
--- a/core/app/models/spree/line_item.rb
+++ b/core/app/models/spree/line_item.rb
@@ -75,7 +75,8 @@ module Spree
extend DisplayMoney
money_methods :amount, :subtotal, :discounted_amount, :final_amount, :total, :price,
- :adjustment_total, :additional_tax_total, :promo_total, :included_tax_total
+ :adjustment_total, :additional_tax_total, :promo_total, :included_tax_total,
+ :pre_tax_amount
alias single_money display_price
alias single_display_amount display_price