WCMp bundle is available at a slashed price

Grab It Now

A few questions about the new Split Order module…

A few questions about the new Split Order module…2019-08-05T08:45:08-05:00

Home Support Forum WCMp Core A few questions about the new Split Order module…

WCMp Core

A few questions about the new Split Order module… Open

Tagged: ,

  • Author
    Posts
  • mairabay
    Participant
    Post count: 23

    Hi there,

    I have a few questions about the new Split Order module.
    I checked the documentation and this forum, but I couldn’t find the information I am looking for.

    1) For the stock control issue described here, do I still need to add this code manually? Or is it now a part of the latest version (WCMp 3.4)?

    2) I have the same use case as described here (I first create an order with On Hold status, and I want the vendor to only know about an order when it is in Processing status). If I add the code suggested in that answer, will the vendor still get an email when the order is first created (in On Hold status)? If so, how do I make sure that the vendor doesn’t get any emails about it? I really want the vendor to only know that an order exists once I set it to processing.

    3) I really like the idea of this module. I was planning on using a plugin to do it, so thank you for adding it to WCMp. However, I also need to be able to merge orders. Here is why: In my business, I can make orders on behalf of customers and have the products shipped to me (and I deliver the products to them in person). So I can make multiple orders with the same vendor in one day (for different customers), but I want the vendor to receive just one order. Is this something that you are thinking about adding in the near future? I think it should be fairly easy to do: just copy a bunch of sub-orders (from different orders) into a new parent order. If you are not thinking about doing that, are there any hooks I could use to develop it on my own?

    Thanks

  • NerdySupportExpert Moumita
    Keymaster
    Post count: 4607

    Hi @mairabay, our replies are inline :

    1) For the stock control issue described here, do I still need to add this code manually? Or is it now a part of the latest version (WCMp 3.4)?

    >> We have added the fix in our latest version 3.4.1

    2) I have the same use case as described here (I first create an order with On Hold status, and I want the vendor to only know about an order when it is in Processing status). If I add the code suggested in that answer, will the vendor still get an email when the order is first created (in On Hold status)? If so, how do I make sure that the vendor doesn’t get any emails about it? I really want the vendor to only know that an order exists once I set it to processing.

    >> Can you please share the code snippet you are referring here.

    3) I really like the idea of this module. I was planning on using a plugin to do it, so thank you for adding it to WCMp. However, I also need to be able to merge orders. Here is why: In my business, I can make orders on behalf of customers and have the products shipped to me (and I deliver the products to them in person). So I can make multiple orders with the same vendor in one day (for different customers), but I want the vendor to receive just one order. Is this something that you are thinking about adding in the near future? I think it should be fairly easy to do: just copy a bunch of sub-orders (from different orders) into a new parent order. If you are not thinking about doing that, are there any hooks I could use to develop it on my own?

    >> Currently we don’t have any such plan to integrate this flow.

    However, you can do custom code and add this flow. Please note, this requires a good amount of custom code, as you need to take care of report, stock, etc for the new orders also.

    Let us know if you have any further query.

  • mairabay
    Participant
    Post count: 23

    Hi Moumita,

    Thanks for the quick reply.

    1) For the stock control issue described here, do I still need to add this code manually? Or is it now a part of the latest version (WCMp 3.4)?

    >> We have added the fix in our latest version 3.4.1

    Great! I just updated to 3.4.1. That was a very timely release 🙂

    2) I have the same use case as described here (I first create an order with On Hold status, and I want the vendor to only know about an order when it is in Processing status). If I add the code suggested in that answer, will the vendor still get an email when the order is first created (in On Hold status)? If so, how do I make sure that the vendor doesn’t get any emails about it? I really want the vendor to only know that an order exists once I set it to processing.

    >> Can you please share the code snippet you are referring here.

    This is the snippet I am talking about:

    add_filter('wcmp_datatable_get_vendor_all_orders', 'order_status',10,3);
    function order_status($args, $requestData, $post_data){
       $get_value_status = array();
       foreach ($args as $key => $value) {
           $order = wc_get_order($value);
           $details = $order->get_status();
           if($details == 'processing'){
               $get_value_status[] = $value;
           }
       }
       return $get_value_status;
    }

    3) I really like the idea of this module. I was planning on using a plugin to do it, so thank you for adding it to WCMp. However, I also need to be able to merge orders. Here is why: In my business, I can make orders on behalf of customers and have the products shipped to me (and I deliver the products to them in person). So I can make multiple orders with the same vendor in one day (for different customers), but I want the vendor to receive just one order. Is this something that you are thinking about adding in the near future? I think it should be fairly easy to do: just copy a bunch of sub-orders (from different orders) into a new parent order. If you are not thinking about doing that, are there any hooks I could use to develop it on my own?

    >> Currently we don’t have any such plan to integrate this flow.

    However, you can do custom code and add this flow. Please note, this requires a good amount of custom code, as you need to take care of report, stock, etc for the new orders also.

    I’m not afraid to do custom code, I’ve been programming for 20 years. I’m just very new to e-commerce. Can you tell me what else needs to be considered besides reports and stock controls?

  • NerdySupportExpert Moumita
    Keymaster
    Post count: 4607

    @mairabay, our replies are inline :

    2. 2) I have the same use case as described here (I first create an order with On Hold status, and I want the vendor to only know about an order when it is in Processing status). If I add the code suggested in that answer, will the vendor still get an email when the order is first created (in On Hold status)? If so, how do I make sure that the vendor doesn’t get any emails about it? I really want the vendor to only know that order exists once I set it to processing.

    >> This code only controls the display of the orders in the vendor order table. Means, adding this code will only display the order with Processing status.

    Now, the flow you want to add need to use some other code. However, as an admin, you need to manage the order status and change that into processing.

    3. I’m not afraid to do custom code, I’ve been programming for 20 years. I’m just very new to e-commerce. Can you tell me what else needs to be considered besides reports and stock controls?

    >> Basically, as the suborders are already placed. Hence when you will create another order, with already existing suborder, hence hen you need to check that new order total should not get added with the sit’s main earning.

    Also, the stock of each product shouldn’t be affected also for this duplicate order.

    Let us know if you have any further query.

  • mairabay
    Participant
    Post count: 23

    Hi Moumita,

    for 2.2)

    Yes, I understand that I will have to manually change the status to Processing. That is what I want.

    I added the snippet and it worked for what it was said on the original post (now the vendor can’t see the Oh Hold orders). However, the vendor is still getting an email when the order is created. This might be because the email the vendor gets is saying that the order is in Processing status, when it is actually On Hold (it goes from Pending Payment to On Hold, never went to Processing) – this is clearly a bug on your side.

    What hook can I use to stop the vendor from getting any emails about the order until it is in Processing status?

    for 3)

    Yes, I will take the earnings into account when thinking about the impact on the reports.

    3.1)
    Regarding stock levels, is there any documentation that explains how the stock is managed in each status? For example, does it get reduced when the order changes to On Hold, or when it changes to Processing? What happens when the order is changed to a custom status?

    3.2)
    Are there any hooks that I can use to change how the stock levels are affected?

    4) I also have another question:

    How does a partial refund work in the new Split Order Module? Is it possible? From the documentation it seems like the vendor can only issue a full refund. Or did I misunderstand?

    Thanks again for clarifying

  • NerdySupportExpert Moumita
    Keymaster
    Post count: 4607

    for 2.2) Yes, I understand that I will have to manually change the status to Processing. That is what I want.
    I added the snippet and it worked for what it was said on the original post (now the vendor can’t see the Oh Hold orders). However, the vendor is still getting an email when the order is created. This might be because the email the vendor gets is saying that the order is in Processing status, when it is actually On Hold (it goes from Pending Payment to On Hold, never went to Processing) – this is clearly a bug on your side.
    What hook can I use to stop the vendor from getting any emails about the order until it is in Processing status?
    >> Kindly use this code snippet :

    add_action('init' , 'vendor_new_order_mail_stop' );
    function vendor_new_order_mail_stop() {
       global $WCMp;
       remove_action( 'wcmp_checkout_vendor_order_processed', array( $WCMp->commission, 'wcmp_create_commission' ), 10, 3);
       add_action( 'wcmp_checkout_vendor_order_processed' , 'wcmp_create_commission_change' ,10 , 3);
    }
    
    function wcmp_create_commission_change( $vendor_order_id, $posted_data, $order ) {
       global $WCMp;
       $processed = get_post_meta($vendor_order_id, '_commissions_processed', true);
       if (!$processed) {
           //$commission_ids = get_post_meta($vendor_order_id, '_commission_ids', true) ? get_post_meta($vendor_order_id, '_commission_ids', true) : array();
           $vendor_order = wc_get_order($vendor_order_id);
           $vendor_id = get_post_meta($vendor_order_id, '_vendor_id', true);
    
           // create vendor commission
           $commission_id = WCMp_Commission::create_commission($vendor_order_id);
           if ($commission_id) {
               // Calculate commission
               WCMp_Commission::calculate_commission($commission_id, $vendor_order);
               update_post_meta($commission_id, '_paid_status', 'unpaid');
               
               // add commission id with associated vendor order
               update_post_meta($vendor_order_id, '_commission_id', $commission_id);
               // Mark commissions as processed
               update_post_meta($vendor_order_id, '_commissions_processed', 'yes');
           }
       }
    }
    
    add_action( 'woocommerce_order_status_processing', 'trigger_mail_after_process_order' );
    function trigger_mail_after_process_order( $order_id ) {
    
       $email_admin = WC()->mailer()->emails['WC_Email_Vendor_New_Order'];
       $email_admin->trigger($order_id);
       return $email_admin;
    }

    for 3) Yes, I will take the earnings into account when thinking about the impact on the reports.
    3.1) Regarding stock levels, is there any documentation that explains how the stock is managed in each status? For example, does it get reduced when the order changes to On Hold, or when it changes to Processing? What happens when the order is changed to a custom status?

    >> The stock status is controlled by WooCommerce, just follow their doc – https://docs.woocommerce.com/document/managing-orders/#section-3

    3.2) Are there any hooks that I can use to change how the stock levels are affected?
    >> Can you explain this a bit more.

    4) I also have another question:
    How does a partial refund work in the new Split Order Module? Is it possible? From the documentation it seems like the vendor can only issue a full refund. Or did I misunderstand?

    >> No, the vendor can also process a partial refund, just like woocomerce. For further details, you can check this documen – https://learnwoo.com/woocommerce-manage-refunds/

  • mairabay
    Participant
    Post count: 23

    Hi Moumita,
    Here is a follow-up to the questions:

    2.2) I ended up using the woocommerce_email_enabled_vendor_new_order instead of the snippet you pasted. Do you foresee any issues with that?
    In the filter I just make some checks and return true or false depending on the checks (I only want to disable the email in certain situations). Here is the code:

    add_filter( 'woocommerce_email_enabled_vendor_new_order', 'myplugin_disable_vendor_email_new_order_for_mycustomtypeoforder', 10, 2 );
    function myplugin_disable_vendor_email_new_order_for_mycustomtypeoforder($enabled, $order){
    	
    	$order_id = $order->get_id();
    
    	if( mycustomfunction_is_order_mycustomtypeoforder($order_id) ){
    		return false;
    	}else{
    		return true;
    	}
    	
    }

    3.1)
    >>> The stock status is controlled by WooCommerce, just follow their doc – https://docs.woocommerce.com/document/managing-orders/#section-3

    Thanks, I found that page useful. But it doesn’t talk about what happens with a custom status. I will try to find this answer from them or make a few tests myself.

    3.2) same as 3.1). I will try to find out this info from WooCommerce.

    4) ok, the link helps a bit. But I still have a few questions:
    4.1) when the vendor sends a refund, does it go to the buyer or to the site owner?
    4.2) if it goes to the buyer,
    4.2.1) does the commission also get automatically debited from the site owner back into the buyer’s account?
    4.2.2) what happens to the taxes and shipping? In the case of my store I keep the taxes but the vendor keeps the shipping. So in this case, would the taxes be debited from my account back into the buyer’s account automatically? And the shipping debited from the vendor’s account into the buyer’s account automatically?

    Thanks for all your help sorting this out!

  • NerdySupportExpert Moumita
    Keymaster
    Post count: 4607

    @mairabay, our replies are inline :

    2.2) I ended up using the woocommerce_email_enabled_vendor_new_order instead of the snippet you pasted. Do you foresee any issues with that?
    In the filter, I just make some checks and return true or false depending on the checks (I only want to disable the email in certain situations).

    >> our new vendor mail does not send email multiple times. So you have to trigger the mail for processing and completed too. Are you facing any issue with this code?

    3.1)The stock status is controlled by WooCommerce, just follow their doc – https://docs.woocommerce.com/document/managing-orders/#section-3

    Thanks, I found that page useful. But it doesn’t talk about what happens with a custom status. I will try to find this answer from them or make a few tests myself.

    >> When a product is sold, woocommerce will reduce its status. And if the product is refunded, then it will handle the status as well.

    Hence, the stock is not depended on any custom status.

    4) ok, the link helps a bit. But I still have a few questions:
    4.1) when the vendor sends a refund, does it go to the buyer or to the site owner?
    4.2) if it goes to the buyer,
    4.2.1) does the commission also get automatically debited from the site owner back into the buyer’s account?
    4.2.2) what happens to the taxes and shipping? In the case of my store I keep the taxes but the vendor keeps the shipping. So in this case, would the taxes be debited from my account back into the buyer’s account automatically? And the shipping debited from the vendor’s account into the buyer’s account automatically?

    >> Can you please check our vendor refund document – https://wc-marketplace.com/knowledgebase/wcmp-split-order-module/#6

    Hence, this depends on the vendor what vendor will refund, as this is a manual process.

    Let us know if you have any further query.

    • mairabay
      Participant
      Post count: 23

      Hi Moumita,
      Thanks for the reply.

      Here are my answers:

      2.2) I ended up using the woocommerce_email_enabled_vendor_new_order instead of the snippet you pasted. Do you foresee any issues with that?
      In the filter, I just make some checks and return true or false depending on the checks (I only want to disable the email in certain situations).

      >> our new vendor mail does not send email multiple times. So you have to trigger the mail for processing and completed too. Are you facing any issue with this code?

      No, I am not facing any issues. Thanks for clarifying about the other statuses too. In my case, I don’t need them as those orders will never get to those statuses (they are sort of like dummy orders in my system, and they use my own custom statuses).

      4) ok, the link helps a bit. But I still have a few questions:
      4.1) when the vendor sends a refund, does it go to the buyer or to the site owner?
      4.2) if it goes to the buyer,
      4.2.1) does the commission also get automatically debited from the site owner back into the buyer’s account?
      4.2.2) what happens to the taxes and shipping? In the case of my store I keep the taxes but the vendor keeps the shipping. So in this case, would the taxes be debited from my account back into the buyer’s account automatically? And the shipping debited from the vendor’s account into the buyer’s account automatically?

      >> Can you please check our vendor refund document – https://wc-marketplace.com/knowledgebase/wcmp-split-order-module/#6

      Ok, from the animation in the page it looks like the vendor can choose to refund the taxes or not. So I have to tell them not to refund the taxes, and then refund the taxes to the customer myself. Wow, I hope you guys are working on making this more automated, because it seems like it will be a lot of work when my store starts having a lot of sales.

      I don’t have any more questions for now. When Angelo is satisfied with the answers, you can close the ticket.

  • Angelo Magrone
    Participant
    Post count: 23

    I don’t understand the workflow of order payment.

    If the customer pay with bank wire the order go to status “pending”. The vendor see the order in dashboard on widget “pending shipping” and can mark shipped without a payment confirm from admin. Why? The vendor should see the orders with “processing” status ( on widget “pending shipping”, on order page, on withdrawal balance, etc).

    If the customer pay with PAYPAL the order go to status “pending”. Why? This order should automatically go to “processing” status.

    The withdrawal request should be possible with “shipped” or “completed” status.

    Can I modify this settings from function.php?

  • NerdySupportExpert Moumita
    Keymaster
    Post count: 4607

    @Angelo Magrone, when a customer pays for an order, the order status depends on what status set by WooCommerce. Now, sync the sub-order status with WooCommerce status for the initial status only.

    Means, for wire transfer, woocommerce will set the parent order as pending. Then all the sub-order will be set as pending too. Now, both admin and vendor will change their own order manually.

    Now, why paypal is settings the order status as pending, for that please check with PayPal. It might be related to the payment issue.

    Shipped is not a status, all the vendor will do is to provide the shipping details. The customer will receive an email with tracking url and id.

    Let us know if you have any further query.

  • Angelo Magrone
    Participant
    Post count: 23

    Ok

    I change the questions:

    1) The customer complete order with payment method: BACS (Woocommerce Bank transfer)
    I do not want the order appear on vendor dashboard, on vendor orders page, on vendors withdrawal page UNTIL admin confirm payment. How should I do?

    2) The customer select PAYPAL but abandons cart. Woocommerce cancel parent order, while suborder is “Pending payment”.
    I do not want the order appear on vendor dashboard, on vendor orders page, on vendors withdrawal page. The suborder status should change to ‘cancelled’. How should I do?

    3) I would like to change the list of status order avaiable on vendors order detail page. Now I see all status avaiable in woocommerce. Is possible to have only “processing” and “completed”?

  • NerdySupportExpert Moumita
    Keymaster
    Post count: 4607

    @Angelo, Our replies are inline : –

    1) The customer complete order with payment method: BACS (Woocommerce Bank transfer)
    I do not want the order appear on vendor dashboard, on vendor orders page, on vendors withdrawal page UNTIL admin confirm payment. How should I do?

    >> After the implementation of split order module, when an order is placed by the customer, it lets the vendor view the order status along with the admin. Now, if you want to show the orders in the vendor’s dashboard only when it is marked as paid, then you have to do custom coding. Kindly do let us know if you need any reference of hook/filter.

    2) The customer select PAYPAL but abandons cart. Woocommerce cancel parent order, while suborder is “Pending payment”.
    I do not want the order appear on vendor dashboard, on vendor orders page, on vendors withdrawal page. The suborder status should change to ‘cancelled’. How should I do?

    >> You can cancel all the suborders when the parent order is canceled. For this, use this code snippet :

    /**
    ** suborder status changed to canceled when parent in canceled
    **/
    add_action( 'woocommerce_order_status_cancelled', 'wcmp_suborder_status_change_to_cancel' );
    function wcmp_suborder_status_change_to_cancel( $order_id ) {
       global $WCMp;
       $suborder_details = $WCMp->order->get_suborders($order_id);
       foreach ($suborder_details as $key => $value) {
           $suborder_fetch = array(
               'ID'           => $value->get_id(),
               'post_status'   => 'wc-cancelled',
           );
           wp_update_post( $suborder_fetch );
       }
    }

    3) 3) I would like to change the list of status order avaiable on vendors order detail page. Now I see all status avaiable in woocommerce. Is possible to have only “processing” and “completed”?

    >> Currently, the vendor will see all the orders as soon as the customer will place the order.
    Now, in order to add this restriction to let view vendor order when they are processing/completed, for this you need to do custom code.

    If you need a reference of hook/filter, let us know.

  • Angelo Magrone
    Participant
    Post count: 23

    Yes, I need a reference of hook/filter.

    Please help me

  • Angelo Magrone
    Participant
    Post count: 23

    it might be useful to add “order status” and “payment method” to the widget of pending shipping orders (seller dashboard).

    But I need a reference of hook/filter

  • NerdySupportExpert Moumita
    Keymaster
    Post count: 4607

    @Angelo Magrone, in order to view orders with Completed/Processing only, add this code to the function.php of the current active theme :

    add_filter('wcmp_datatable_get_vendor_all_orders', 'order_status',10,3);
    function order_status($args, $requestData, $post_data){
      $get_value_status = array();
      foreach ($args as $key => $value) {
          $order = wc_get_order($value);
          $details = $order->get_status();
          if($details == 'processing' || $details == 'completed' ){
              $get_value_status[] = $value;
          }
      }
      return $get_value_status;
    }
  • Angelo Magrone
    Participant
    Post count: 23

    Hi @moumita

    thank for your code. I had already found this snippet.

    However, this code does not work on
    – Vendor Dashboard > [Home] > “Pending shipping” widget
    – Vendor Dashboard > Report > Overview
    – Vendor Dashboard > Withdrawal

    A filter is required for this

Please LOGIN to reply to this topic