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
Greetings,
I am trying to implement a way to ship our Klarna payments upon changing an order to a custom status in the most streamlined way possible, which has made me familiar with the plugin code.
The current implementation has an action hook to woocommerce_order_status_complete which is straightforward. The function for that call however requires an initialized Modularity package which is booted and ready as it has in-class calls and one cannot simply add a hook for woocommerce_order_status_fulfilled with a newly constructed PaymentModule class.
Is there a simple way to initialize the package with its containers and then pass the instance along with the method to the add_action() ?
One proper way would be writing a custom module to pass to the initialize() function's filter but that seems an overkill and in breach of the DRY principle.
A more hacky way would be hooking to the .ready hooks of the inpsyde booter and passing the container as a global for the status change action but my attempts at that show little promise.
Any hints are appreciated.
Regards,
Daniel
The text was updated successfully, but these errors were encountered:
Hello @sertys3, thanks for your suggestion! This use case should be covered in #955, allowing you to filter the action hooks for shipping and canceling orders. It will probably be included in the next update. Please let us know if this covers your needs.
Additionally, the team is working on an API to perform basic actions, including programmatically shipping orders. I hope this helps you to keep things simple.
Greetings,
I am trying to implement a way to ship our Klarna payments upon changing an order to a custom status in the most streamlined way possible, which has made me familiar with the plugin code.
The current implementation has an action hook to woocommerce_order_status_complete which is straightforward. The function for that call however requires an initialized Modularity package which is booted and ready as it has in-class calls and one cannot simply add a hook for woocommerce_order_status_fulfilled with a newly constructed PaymentModule class.
Is there a simple way to initialize the package with its containers and then pass the instance along with the method to the add_action() ?
One proper way would be writing a custom module to pass to the initialize() function's filter but that seems an overkill and in breach of the DRY principle.
A more hacky way would be hooking to the .ready hooks of the inpsyde booter and passing the container as a global for the status change action but my attempts at that show little promise.
Any hints are appreciated.
Regards,
Daniel
The text was updated successfully, but these errors were encountered: