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
Fixed `PromotionHandler::FreeShipping` with multiple coupon codes promos
Damian Legawieca7c05fb18479
diff --git a/core/app/models/spree/promotion_handler/free_shipping.rb b/core/app/models/spree/promotion_handler/free_shipping.rbindex cc76b879b0..200ebba2a0 100644--- a/core/app/models/spree/promotion_handler/free_shipping.rb+++ b/core/app/models/spree/promotion_handler/free_shipping.rb@@ -13,7 +13,7 @@ module Spreedef activatepromotions.each do |promotion|- next if promotion.code.present? && !order_promo_ids.include?(promotion.id)+ next if promotion.coupon_code? && !order_promo_ids.include?(promotion.id)promotion.activate(order: order) if promotion.eligible?(order)enddiff --git a/core/spec/models/spree/promotion_handler/free_shipping_spec.rb b/core/spec/models/spree/promotion_handler/free_shipping_spec.rbindex 89fd5262cf..07ba6b07d9 100644--- a/core/spec/models/spree/promotion_handler/free_shipping_spec.rb+++ b/core/spec/models/spree/promotion_handler/free_shipping_spec.rb@@ -28,6 +28,10 @@ module Spreeexpect { subject.activate }.to change { shipment.adjustments.count }end++ it 'does not adjust the shipment when not applied to order' do+ expect { subject.activate }.not_to change { shipment.adjustments.count }+ endendcontext 'if promo has multiple codes' do@@ -39,6 +43,10 @@ module Spreeexpect { subject.activate }.to change { shipment.adjustments.count }end++ it 'does not adjust the shipment when not applied to order' do+ expect { subject.activate }.not_to change { shipment.adjustments.count }+ endendcontext 'if promo has a path' do