Created
September 14, 2022 19:15
-
-
Save davidgoldcode/d40bdcacb45741f714c5fba1b86198d6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/commands/apply_individual_discounts.rb b/app/commands/apply_individual_discounts.rb | |
index e39a96cd8c..534d134020 100644 | |
--- a/app/commands/apply_individual_discounts.rb | |
+++ b/app/commands/apply_individual_discounts.rb | |
@@ -3,7 +3,7 @@ class ApplyIndividualDiscounts | |
def perform(event_name, order) | |
return if event_name != "spree.cart.add" || order.blank? | |
- order.line_items_with_current_flash_sales.each do |line_item| | |
+ order.line_items_with_current_flash_sales.uniq.each do |line_item| | |
current_discount = line_item&.variant&.product&.current_discount | |
next if !current_discount || !current_discount[:is_individual_discount] || current_discount[:percent] == 0 | |
percent = -0.01 * current_discount[:percent] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment