azerothcore / acore-cms

ACore CMS based on Wordpress
https://www.azerothcore.org/acore-cms/
50 stars 33 forks source link

Manually processing an order with non-instant payment gateway #12

Open jake-acore opened 3 years ago

jake-acore commented 3 years ago

Dear Contributers of this CMS.

If I order an item in Woocommerce with an instant payment method (Paypal for example) everything works fine, the items in this order will send out to the ingame-character, when the payment was succesfull.

But If I am using a non-instant payment gateway (lets say bank tranfer), where I as an admin manually have to proceed the order via admin-panel the items will not send out when I change the order status in the admin panel.

Is this indented to work like this? I mean is a feature for these gateways implemented? Or do I have to do something else.

How to reproduce the issue: Active Plugins: Woocommerce V 4.8/ AzerothCore Wordpress Integration V 0.1 Woocommerce Payment Gateway: Direct bank transfer

Step 1: Order an Item (SKU can be anything for example itemsend_43599) price has to be greater than zero otherwise (free product) the payment gateway (direct bank tranfer) is not being used.

Step 2: After the order is placed. The order status goes to "on hold" because you are awaiting a payment that you as an admin manually has to verify.

Step 3: If you now manually change the order-status to "processing" or "completed" the items will not send out to the ingame-characters.

Best Regards Jake

--- Want to back this issue? **[Post a bounty on it!](https://app.bountysource.com/issues/95339531-manually-processing-an-order-with-non-instant-payment-gateway?utm_campaign=plugin&utm_content=tracker%2F182917716&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://app.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F182917716&utm_medium=issues&utm_source=github).
Yehonal commented 3 years ago

This is a known issue. For now there's not a proper solution though, you can use a workaround if you want to use other payment types.

You can install the MyCred plugin: https://mycred.me/ and set the mycred virtual coin as the only payment method for the users.

Basically, the users will buy the virtual coins first (you have all the payment gateway available), then they will buy the items in woocommerce with those coins with instant payment.

I hope it can fit your needs

Ercules76 commented 1 month ago

The behavior you're experiencing is related to how WooCommerce handles different payment gateways. With instant payment methods like PayPal, the woocommerce_payment_complete hook is triggered automatically upon payment confirmation, which initiates processes like sending items to in-game characters.

However, for non-instant payment methods (e.g., bank transfer or COD), the system doesn't trigger this hook automatically because the payment confirmation requires manual intervention. When you manually mark the order as "completed" in the admin panel, the appropriate hook that gets triggered is woocommerce_order_status_completed.

In this case, the system would need to be configured to ensure that the action (like sending the items to the in-game character) is linked to the woocommerce_order_status_completed hook. This would allow the same actions to happen when an order is manually completed as with instant payments.