Home Forums Theme Support Dokan Orders get duplicated in earnings

This topic is: resolved

This topic contains 16 replies, has 4 voices, and was last updated by  Jani 4 years, 2 months ago.

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #31265

    Joonas
    Member
    Post count: 18

    I have a serious issue: some orders are counted twice in Dokan earnings, causing sellers to see too higher earnings than what they have actually sold. For example, I have a user who has sold 11 products, each 5 €. Seller Percentage is set to 80%, so seller's balance should be 44 €. But the system shows 60 € as seller's balance!

    When going in admin panel to Dokan > Earning Reports > All Logs ei get this list with same order id in multiple rows.

    #8688 Anna (muokkaa) 5,00 € 4,00 € 1,00 € wc-processing
    #8680 Anna (muokkaa) 5,00 € 4,00 € 1,00 € wc-processing
    #8680 Anna (muokkaa) 5,00 € 4,00 € 1,00 € wc-processing

    (8680 is doubled – there are also other duplicates)

    What could be causing this and how can I fix this?

    #31281

    Nayem
    Moderator
    Post count: 6480

    Hello Joonas,

    I tested your issue but for me everything is working fine. I checked the earning reports when a customer purchased couple of or single product from a single seller and with the 80% seller percentage.But i did not find any duplicate earning reports or commission problem.

    Did you test it any other way?. If yes, then please tell me the testing procedure to reproduce this issue.

    Thank you 🙂

    #31287

    Joonas
    Member
    Post count: 18

    When I go to database and see the table wp_dokan_orders, I can see same order_id – seller_id combination in multiple rows. So the seller earns from same order multiple times, but I get the money only once.

    Shouldn't be a constraint that the same order_id – seller_id combination may exist only once?

    
    id  order_id seller_id order_total net_amount order_status
    120 8786     43        5.00        4.00       wc-processing
    119 8781     49        5.00        4.00       wc-pending
    118 8781     49        5.00        4.00       wc-pending
    117 8781     49        5.00        4.00       wc-pending
    116 8778     49        5.00        4.00       wc-processing
    115 8688     49        5.00        4.00       wc-completed
    114 8680     49        5.00        4.00       wc-completed
    113 8663     49        5.00        4.00       wc-cancelled
    112 8663     49        5.00        4.00       wc-cancelled
    
    #31290

    Nayem
    Moderator
    Post count: 6480

    Hello Joonas,

    I have already tested database too. For me its running fine. Can you please update your plugin to the latest version Dokan(v1.3). Please check after updating your plugin and let me know.

    Thank you 🙂

    #31293

    Joonas
    Member
    Post count: 18

    I'd like to have it confirmed that in database table dokan_orders, by design if there should or shouldn't be multiple rows that contain the same order_id seller_id combination. Can you check this from the dev team?

    #31294

    Nayem
    Moderator
    Post count: 6480

    Hello Joonas,

    I will discuss about your issue with our developer team. Please allow me some time. I will be back to you with the right solution.

    Thank you 🙂

    #31295

    Joonas
    Member
    Post count: 18

    Thank you Nayem!

    #31297

    Nayem
    Moderator
    Post count: 6480

    Hello Jonas,

    I have discussed with our developer team. Please check for plugin conflict. Make disable all of your plugins except Dokan. Kindly check and let me know. I am here to help you.

    Thank you 🙂

    #31389

    Joonas
    Member
    Post count: 18

    I don't see how this could be plugin conflict, but I disabled other plugins anyway, no help.

    Could I just get a clear answer (yes or no): is there an error in the database data when there are multiple rows with same order-id, seller-id combination, in the table dokan-orders?

    #31390

    Joonas
    Member
    Post count: 18

    Now I deleted all the duplicate rows in database, and now earning reports are correct.

    The question is, what could be causing these duplicate rows, and do the keep coming up in future?

    #31393

    Joonas
    Member
    Post count: 18

    Actually, shouldn't order_id – seller_id combination be the primary key of dokan_orders?

    #31399

    Joonas
    Member
    Post count: 18

    In the file /includes/wc-functions.php I see that row 1140 has changed in v1.2, from

    
    do_action( 'dokan_checkout_update_order_meta', $order_id );
    

    to

    
    do_action( 'dokan_checkout_update_order_meta', $order_id, $seller_id );
    

    Can you confirm if this fixes the error?

    #31425

    Nayem
    Moderator
    Post count: 6480

    Hello Joonas,

    You asked for a clear answer(yes or no). Dokan has no error in the database. We tested it many times here but everything working fine.

    You also mentioned this code do_action( 'dokan_checkout_update_order_meta', $order_id, $seller_id );.
    This code is not related with database. It is just a hook. it will not fix any error. I have discussed with our developer team. Any third party plugin may be the reason of this. I think you can go for a fresh installation of Dokan without installing any other plugin.

    Please check and let me know. Thank you 🙂

    #31974

    Joonas
    Member
    Post count: 18

    A follow-up on this. I added a unique constraint in my MySQL database for dokan_orders:

    ALTER TABLE dokan_orders
    ADD CONSTRAINT order_seller UNIQUE (order_id,seller_id)

    This fixed my problem, since multiple rows with same order_id and seller_id are no longer allowed. I think Dokan should, in it's own code, either add this kind of constraint to dokan_orders or use seller_id – order_id combination as primary key.

    #34079

    Pablo
    Member
    Post count: 3

    Hi,

    I'm having the same issue!

    I will try your way joonas…

    Could you guide me through?

    thanks

Viewing 15 posts - 1 through 15 (of 17 total)

The topic ‘Orders get duplicated in earnings’ is closed to new replies.