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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Add PriceSerializer.
Sebastian Palmaeb3cb80feec1
diff --git a/api/app/serializers/spree/api/v2/platform/price_serializer.rb b/api/app/serializers/spree/api/v2/platform/price_serializer.rbnew file mode 100644index 0000000000..dc441093b4--- /dev/null+++ b/api/app/serializers/spree/api/v2/platform/price_serializer.rb@@ -0,0 +1,23 @@+module Spree+ module Api+ module V2+ module Platform+ class PriceSerializer < BaseSerializer+ include ResourceSerializerConcern++ attribute :display_price_including_vat_for do |price|+ price.display_price_including_vat_for({})+ end++ attribute :display_compare_at_price do |price|+ price.display_price_including_vat_for({})+ end++ attribute :display_compare_at_price_including_vat_for do |price|+ price.display_compare_at_price_including_vat_for({})+ end+ end+ end+ end+ end+enddiff --git a/api/spec/spec_helper.rb b/api/spec/spec_helper.rbindex 048eec52b7..f98384f52e 100644--- a/api/spec/spec_helper.rb+++ b/api/spec/spec_helper.rb@@ -67,16 +67,15 @@ RSpec.configure do |config|config.include Spree::TestingSupport::ImageHelpersDummySerializer = Struct.new(:_) { def serializable_hash; {}; end }- Spree::Api::V2::Platform::ShippingCategorySerializer = DummySerializer- Spree::Api::V2::Platform::PriceSerializer = DummySerializer- Spree::Api::V2::Platform::StoreProductSerializer = DummySerializerSpree::Api::V2::Platform::BogusSerializer = DummySerializerSpree::Api::V2::Platform::FlatRateSerializer = DummySerializerSpree::Api::V2::Platform::LegacyUserSerializer = DummySerializerSpree::Api::V2::Platform::OptionValueVariantSerializer = DummySerializer+ Spree::Api::V2::Platform::ShippingCategorySerializer = DummySerializerSpree::Api::V2::Platform::ShippingMethodCategorySerializer = DummySerializerSpree::Api::V2::Platform::ShippingMethodZoneSerializer = DummySerializerSpree::Api::V2::Platform::StockMovementSerializer = DummySerializer+ Spree::Api::V2::Platform::StoreProductSerializer = DummySerializerconfig.before doENV['DISABLE_SPREE_WEBHOOKS'] = 'true'