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.

Use constantize in remove item service call

piotrpankof945c6a66a92
diff --git a/core/app/models/spree/promotion_handler/coupon.rb b/core/app/models/spree/promotion_handler/coupon.rb
index b6bd0bfeaf..e73afbabd0 100644
--- a/core/app/models/spree/promotion_handler/coupon.rb
+++ b/core/app/models/spree/promotion_handler/coupon.rb
@@ -25,7 +25,6 @@ module Spree
def remove(coupon_code)
promotion = order.promotions.with_coupon_code(coupon_code)
-
if promotion.present?
# Order promotion has to be destroyed before line item removing
order.order_promotions.where(promotion_id: promotion.id).destroy_all
@@ -76,7 +75,7 @@ module Spree
line_item = order.find_line_item_by_variant(item.variant)
next if line_item.blank?
- Spree::Dependencies.cart_remove_item_service(order: order, item: item.variant, quantity: item.quantity)
+ Spree::Dependencies.cart_remove_item_service.constantize.call(order: order, item: item.variant, quantity: item.quantity)
end
end