Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shipping klarna payments on custom order statuses #948

Closed
sertys3 opened this issue Oct 10, 2024 · 1 comment · May be fixed by #955
Closed

Shipping klarna payments on custom order statuses #948

sertys3 opened this issue Oct 10, 2024 · 1 comment · May be fixed by #955

Comments

@sertys3
Copy link

sertys3 commented Oct 10, 2024

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

@InpsydeNiklas
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants