Skip to content

It is difficult to trigger actions when an order is "really" complete. #387

@Senjai

Description

@Senjai

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.

  1. Using an after save hook on the order
  2. 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions