Sha256: e362ddac08a88893e24fd502e8ea1d79323ece90a0eaaf60170b215ce90fa2c6

Contents?: true

Size: 503 Bytes

Versions: 3

Compression:

Stored size: 503 Bytes

Contents

# frozen_string_literal: true

module Spree
  # Clears promotions from an emptied order
  class OrderPromotionSubscriber
    include Omnes::Subscriber

    handle :order_emptied,
           with: :clear_order_promotions,
           id: :spree_order_promotion_clear_order_promotions

    # Clears all promotions from the order
    #
    # @param event [Omnes::UnstructuredEvent]
    def clear_order_promotions(event)
      order = event[:order]
      order.order_promotions.destroy_all
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solidus_legacy_promotions-4.4.2 app/subscribers/spree/order_promotion_subscriber.rb
solidus_legacy_promotions-4.4.1 app/subscribers/spree/order_promotion_subscriber.rb
solidus_legacy_promotions-4.4.0 app/subscribers/spree/order_promotion_subscriber.rb