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
Improve `Shipment#with_free_shipping_promotion?` (#13041)
Damian Legawiec2277f9424cab
diff --git a/core/app/models/spree/shipment.rb b/core/app/models/spree/shipment.rbindex 3ce642e74b..e90b618a1c 100644--- a/core/app/models/spree/shipment.rb+++ b/core/app/models/spree/shipment.rb@@ -201,8 +201,11 @@ module Spreewith_free_shipping_promotion?end+ # Returns true if the shipment has a free shipping promotion applied+ #+ # @return [Boolean]def with_free_shipping_promotion?- adjustments.promotion.any? { |p| p.source.type == 'Spree::Promotion::Actions::FreeShipping' }+ adjustments.promotion.includes(:source).any? { |p| p.source.respond_to?(:free_shipping?) && p.source.free_shipping? }enddef finalize!