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.

API v2 always include shipping rates as shipment relationship

Damian Legawiece10be4427eab
diff --git a/api/app/controllers/spree/api/v2/storefront/checkout_controller.rb b/api/app/controllers/spree/api/v2/storefront/checkout_controller.rb
index 11c8056eeb..8ceef14038 100644
--- a/api/app/controllers/spree/api/v2/storefront/checkout_controller.rb
+++ b/api/app/controllers/spree/api/v2/storefront/checkout_controller.rb
@@ -125,8 +125,7 @@ module Spree
def serialize_shipping_rates(shipments)
shipping_rates_serializer.new(
shipments,
- include: [:shipping_rates, :stock_location],
- params: { show_rates: true }
+ include: [:shipping_rates, :stock_location]
).serializable_hash
end
end
diff --git a/api/app/serializers/spree/v2/storefront/shipment_serializer.rb b/api/app/serializers/spree/v2/storefront/shipment_serializer.rb
index 3b4f6a1d60..c948d2ee60 100644
--- a/api/app/serializers/spree/v2/storefront/shipment_serializer.rb
+++ b/api/app/serializers/spree/v2/storefront/shipment_serializer.rb
@@ -9,7 +9,7 @@ module Spree
attribute :free, &:free?
- has_many :shipping_rates, if: proc { |_record, params| params&.dig(:show_rates) }
+ has_many :shipping_rates
belongs_to :stock_location
end