• Resolved hector0371

    (@hector0371)


    I was making a function to be executed after an order is completed and its credit is transferred to users dokan account. I was using woocommerce_order_status_completed, but it turned out that this hook is triggered before that orders credit got to the account. What is the proper hook that should be used then?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello @hector0371 ,

    Would you mind clearing up some of the confusion? Let me know which user account credit you are talking about. Is it the vendor account or the admin, or the customer account? Also, which payment gateway are you using? Is it an adaptive or non-adaptive payment method?

    Depending on the user account and the payment method, the hook will differ. Also, could you elaborate on your use case to explain what kind of functions you are using to achieve what type of functionality?

    Regards!

    Thread Starter hector0371

    (@hector0371)

    @yusuf13

    Thank you for your reply. Here is a simple demonstration of the use of my function:

    1. hook onto a trigger when a woocommerce/dokan order status changed to complete and the orders credit is transferred to vendors dokan account (I am using woocommerce_order_status_completed in this case)

    2.automatically create a withdraw request for the vendor, with amount equal to all of his account available credit, using method ‘woo-wallet'(Terawallet)

    3.automatically approve this withdraw request, transferring credit from his account balance to his woo-wallet(Terawallet) account

    This is what this function supposed to work. After it finished, the vendor balance should become 0. However, when I finished running it, the vendor balance remain the last order credit just approved. I think that means my function was triggered before the last completed order credit went into vendor balance.

    • This reply was modified 2 years, 1 month ago by hector0371.

    Right now there is no hook available to achieve this. However $wpdb->prefix . 'dokan_vendor_balance' is the table responsible for storing vendor balance-related data. You can study this table structure and data, and probably schedule a task (daily/twice daily) to check this table content and do whatever you want with that data.

    Thread Starter hector0371

    (@hector0371)

    @zikubd

    Well, I see. Thank you for your reply. I have managed to solve it using another approach.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘What is the hook after order is completed and credited?’ is closed to new replies.