• Resolved loopforever

    (@loopforever)


    Hello there,
    I want to allow the customer to cancel the order during the order processing phase. Therefore, the customer can cancel the order if the order status is “processing”.
    I am using the woocommerce_valid_order_statuses_for_cancel filter to achieve this. But there is a problem for Dokan.
    If the customer buys products from more than one seller, his entire order is cancelled. How can I solve this problem?

    As you know, if a customer purchases products from more than one vendor, a new order type is created: Sub-Order.
    So the button should appear here.
    How can I define this bot in the sub-orders section of My Account>My Orders> (Any Order)> View>

    Thank you for your interest.

    add_filter( 'woocommerce_valid_order_statuses_for_cancel', 'custom_valid_order_statuses_for_cancel', 10, 1 );
    function custom_valid_order_statuses_for_cancel( $statuses ){
    
        // Set HERE the order statuses where you want the cancel button to appear
        return array_merge( $statuses, array('processing'));
    }
Viewing 5 replies - 1 through 5 (of 5 total)
  • Shafinoid

    (@shafinahmad01)

    Hello @loopforever

    Thanks a lot for your valuable query. to achieve the mentioned requirement, customizations will be required. As via a third-party plugin, you can only access the WooCommerce order which will cancel the whole order regardless of the vendor’s sub-order created by the Dokan plugin. You will need to create a function that can determine the sub-orders regarding the vendors and will let the customers cancel a particular sub-order.

    Here’s the file path where you can file the regarding functions and files,

    File Path: wp-content\plugins\dokan-lite\includes\Order\
    File Name: functions.php

    As per our support policy, we are not able to provide any custom solutions but you can contact us regarding customizations from here.

    Have an amazing day!

    • This reply was modified 3 years, 7 months ago by Shafinoid.
    Thread Starter loopforever

    (@loopforever)

    Thank you very much for your reply @shafinahmad01. I’m working on this right now. However, there is a problem that I cannot solve.
    As far as I can see, suborders do not occur if the seller is one and there is more than one product.
    How can I check if the seller is more than one or only one?

    Thread Starter loopforever

    (@loopforever)

    Adding:
    I should make this distinction on the page in the woocommerce/myaccount/orders.php file.

    Thread Starter loopforever

    (@loopforever)

    I solved the problem. Thank you. Maybe it will help someone else:
    if ($order->get_meta('has_sub_order')):

    Shafinoid

    (@shafinahmad01)

    Hello @loopforever

    I’m really glad that you have solved that issue on your own. Also, thanks for sharing the condition, I believe that will help other users as well who are seeking a similar solution.

    Stay safe and feel free to share your queries anytime.
    Best Regards!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Dokan Customer Order Cancel Problem’ is closed to new replies.