Home Spree -- Remove/Clear previous promotions when a new promotion applied
Reply: 0

Spree -- Remove/Clear previous promotions when a new promotion applied

user837
1#
user837 Published in August 15, 2018, 5:37 am

I am maintaining an old project that is using branch 2-4-stable of spree

lets say I used a promotion with coupon code AAAA at /cart and than I changed my mind and used promotion BBBB at /cart. Now when I change my mind second time and try to add promotion AAAA /cart it says

The coupon code has already been applied to this order

The code that checks in promotion has been applied is present at

....../bundler/gems/spree-651f537d0d89/core/app/models/spree/promotion_handler/coupon.rb

  def promotion_exists_on_order?(order, promotion)
    order.promotions.include? promotion
  end

I want order.promotions to only contain one promotion of coupon code.

Any idea how this can be achieved?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.343912 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO