forked from solidusio/solidus
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request solidusio#5797 from mamhoff/fix-reloading-state-ma…
…chine-transition Legacy Promotions: Fix shipping promo application after state machine reload
- Loading branch information
Showing
3 changed files
with
33 additions
and
9 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
...tions/app/decorators/solidus_legacy_promotions/lib/spree_order_state_machine_decorator.rb
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# frozen_string_literal: true | ||
|
||
require_dependency "spree/core/state_machines/order" | ||
|
||
module SolidusLegacyPromotions | ||
module SpreeOrderStateMachineDecorator | ||
def define_state_machine! | ||
super | ||
state_machine do | ||
if states[:delivery] | ||
before_transition from: :delivery, do: :apply_shipping_promotions | ||
end | ||
end | ||
end | ||
|
||
Spree::Core::StateMachines::Order::ClassMethods.prepend self | ||
end | ||
end |
This file contains 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
This file contains 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