• Resolved TregRek

    (@asgarcia103)


    Hey! I’m trying to send some custom fields from the parent order into the sub orders created when a customer buys from different vendors but the “dokan_create_sub_order” function is deprecated and I can’t seem to find what took it’s place, could you help me with the name of the hook or function that creates those sub orders?

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

    In Dokan Multivendor, the main hook that’s typically responsible for creating sub-orders (vendor orders) is dokan_checkout_update_order_meta. This hook works alongside the core function that handles the sub-order creation process.

    The exact implementation might vary depending on which version of Dokan you’re using. If you need to hook into or modify the sub-order creation process, you might want to check the following hooks as well:

    • dokan_create_sub_order
    • dokan_after_create_sub_order
    • dokan_checkout_update_order_meta

    Thanks!

    Thread Starter TregRek

    (@asgarcia103)

    Hey @fayeakuzzaman

    I have downloaded the 3.14.11 Dokan Lite version and in the Includes folder I found the dokan_create_sub_order function as deprecated in the wc-legacy-functions.php file so that’s why my question was which function replaced it as I haven’t been able to find the wc_deprecated_function( 'dokan_create_sub_order', '3.7.13', 'dokan()->order->create_sub_order()' ) function anywhere else in the files. It would be very helpful if you could point me in the direction of the files the have the hooks you mentioned before should they be still functional in the version I mentioned (3.14.11). Thanks for your answer and also thanks in advance for your support.

    Cheers!

    • This reply was modified 1 year, 1 month ago by TregRek.

    Hello @asgarcia103,

    Thank you for getting back to us!

    I’m sharing two functions that will help you create sub-orders. The first function is for manually creating a sub-order, while the second one is used for automating the sub-order creation process.

    1. dokan()->order->maybe_split_orders( $parent_order_id, $force_create = false ): void
      This function allows you to manually split and create sub-orders for the given parent order.
    2. dokan()->order->create_sub_order( $parent_order, $seller_id, $seller_products ): void
      This function is for automating the creation of sub-orders based on the parent order, seller ID, and products associated with the seller.

    Let me know if you need further clarification!

    Thanks!

    Hello @asgarcia103,

    As we haven’t heard back from you for a while, we’ll consider this topic resolved. If you encounter any further issues, please don’t hesitate to open a new topic.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Sub order creation function’ is closed to new replies.