You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as I know, if you have to perform an action when a orders' state, shipment_state, and payment_state is "complete", "shipped", and "paid" respectively at the time that the order satisfies those conditions, you're pretty much out of luck.
I would consider an order in those three states to be a "fulfilled" order where all obligations of the merchant to the customer are complete.
I've tried the below before I tried to implement some other custom solution on top of this, or inject behaviour into every state machine.
Using an after save hook on the order
Registering an update hook with Spree::Order.register_update_hook
The first doesn't work because the order updater uses update_columns
The second doesn't work because the several modules, like OrderShipping, uses the updater to calculate the new state, and then persists the state itself. run_hooks only ever being called in OrderUpdater#update!
Does anyone have any suggestions on making this a more fluid and robust process?
The text was updated successfully, but these errors were encountered:
Yep! People can add their own logic with Spree::Order#register_update_hook which will now properly get triggered on every solidus supported state change.
As far as I know, if you have to perform an action when a orders' state, shipment_state, and payment_state is "complete", "shipped", and "paid" respectively at the time that the order satisfies those conditions, you're pretty much out of luck.
I would consider an order in those three states to be a "fulfilled" order where all obligations of the merchant to the customer are complete.
I've tried the below before I tried to implement some other custom solution on top of this, or inject behaviour into every state machine.
Spree::Order.register_update_hook
The first doesn't work because the order updater uses
update_columns
The second doesn't work because the several modules, like
OrderShipping
, uses the updater to calculate the new state, and then persists the state itself.run_hooks
only ever being called inOrderUpdater#update!
Does anyone have any suggestions on making this a more fluid and robust process?
The text was updated successfully, but these errors were encountered: