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
SD-892 Move has_free_shipping? function into order model
Krzysztof Kalisz0ac3e7ce09bf
diff --git a/core/app/models/spree/order.rb b/core/app/models/spree/order.rbindex 0a51e48a37..39909531bd 100644--- a/core/app/models/spree/order.rb+++ b/core/app/models/spree/order.rb@@ -643,6 +643,13 @@ module Spreesum(:amount)end+ def has_free_shipping?+ promotions.+ joins(:promotion_actions).+ where(spree_promotion_actions: { type: 'Spree::Promotion::Actions::FreeShipping' }).+ exists?+ end+privatedef link_by_emaildiff --git a/frontend/app/helpers/spree/orders_helper.rb b/frontend/app/helpers/spree/orders_helper.rbindex 1af823ff16..17444cf105 100644--- a/frontend/app/helpers/spree/orders_helper.rb+++ b/frontend/app/helpers/spree/orders_helper.rb@@ -3,12 +3,5 @@ module Spreedef order_just_completed?(order)flash[:order_completed] && order.present?end-- def order_has_free_shipping?(order)- order.promotions.- joins(:promotion_actions).- where(spree_promotion_actions: { type: 'Spree::Promotion::Actions::FreeShipping' }).- exists?- endendenddiff --git a/frontend/app/views/spree/checkout/_summary.html.erb b/frontend/app/views/spree/checkout/_summary.html.erbindex e4e1f0386a..472c9724ce 100644--- a/frontend/app/views/spree/checkout/_summary.html.erb+++ b/frontend/app/views/spree/checkout/_summary.html.erb@@ -27,7 +27,7 @@<% end %><% if order.passed_checkout_step?("address") && order.shipments.any? %>- <% if order_has_free_shipping?(order) %>+ <% if order.has_free_shipping? %><div class="d-table-cell"><%= Spree.t(:shipping) %>:</div><div class="d-table-cell text-right"><%= Spree.t(:free) %></div><% else %>