blob: bba173e6b7011f8f5ee9383052e37fb6406186a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# frozen_string_literal: true
module SolidusSubscriptions
module Spree
module Variant
module AutoDeleteFromSubscriptions
def self.prepended(base)
base.after_discard(:remove_from_subscriptions)
base.after_destroy(:remove_from_subscriptions)
end
def remove_from_subscriptions
SolidusSubscriptions::LineItem.where(subscribable: self).delete_all
end
end
end
end
end
Spree::Variant.prepend(SolidusSubscriptions::Spree::Variant::AutoDeleteFromSubscriptions)
|