Support » Plugin: Order Splitter for WooCommerce » hook for status update

  • Resolved kranate


    it isn’t possible to select the status for orders they get after splitting.
    is there a hook we can use for customization like this?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Fahad Mahmood


    Did you check the settings page?

    There is an option for the child orders, which are supposed to be created after split. Kindly check the screenshot and try it if you get it.

    sorry.. may be it was to late yesterday.
    I found the option and will check this.

    thank you for your support!

    sorry.. here I am again.

    The option works fine.
    But I need for my workflow the option to CHANGE the status after creating the order. I guess that the splitted order would be created with the selected status. I think the plugin tribe events calendar expects the transition to the status processing for generating a ticket.

    could you help here? may be with a hook I can you use after creating the splitted order?

    Plugin Author Fahad Mahmood


    Following hooks can be tried, although these are muted in this plugin:

    add_action('woocommerce_order_status_pending', 'wc_os_checkout_order_processed');
    add_action('woocommerce_order_status_on-hold', 'wc_os_checkout_order_processed');
    add_action('woocommerce_order_status_processing', 'wc_os_checkout_order_processed');
    add_action('woocommerce_order_status_completed', 'wc_os_checkout_order_processed');

    Following hooks can be tried with different priority number:

    add_action('woocommerce_thankyou', 'wc_os_checkout_order_processed', 10, 1);
    add_action( 'save_post', 'order_details_page_saved', 11 );	

    it seems that I get with the following code only the order data of the deleted/old order.
    not from the new splitted orders.
    could you please help me fetching the new orders in my child theme functions.php

    add_action( 'woocommerce_thankyou', 'woocommerce_auto_bearbeitung', 1000, 1);
    function woocommerce_auto_bearbeitung( $order_id ) {
        if ( ! $order_id )
        $order = wc_get_order( $order_id );	
    Plugin Author Fahad Mahmood


    function woocommerce_auto_bearbeitung( $order_id ) {
    if ( ! $order_id )
    $args = array(
    			'posts_per_page'   => -1,
    			'offset'           => 0,
    			'cat'         => '',
    			'category_name'    => '',
    			'orderby'          => 'date',
    			'order'            => 'DESC',
    			'include'          => '',
    			'exclude'          => '',
    			'meta_key'         => 'splitted_from',
    			'meta_value'       => $order_id,
    			'post_type'        => 'shop_order',
    			'post_mime_type'   => '',
    			'post_parent'      => '',
    			'author'	   => '',
    			'author_name'	   => '',
    			'post_status'      => 'any',
    			'suppress_filters' => true,
    			'fields'           => '',
    		$posts_array = get_posts( $args );

    Hi Fahad!

    I think I found a better solution for Events Calendar Plugin.
    It is important for that to “generate tickets” when purchased.
    So after splitting/duplicating this have to be done again.

    could you please add something like the following to your code:

    update_post_meta( $new_order_id, '_tribe_has_tickets', '');

    • This reply was modified 1 week, 3 days ago by kranate.
    • This reply was modified 1 week, 3 days ago by kranate.
    Plugin Author Fahad Mahmood


    @kranate but i am create new orders on many places, it will be an extra meta key for each order. Do you recommend this?

    yes, that’s correct.
    every new order needs this meta key with NULL. so you will have a better support for the tribe plugins.
    at the moment the existing meta key with value “1” is cloned. an that makes the problem with the tickets.

    thank you!

    I think it would also work fine with:

    delete_post_meta($order_id, '_tribe_has_tickets');

    could you add this to your next version?
    and for further clarify..
    it’s not about setting a meta key.
    the existing meta key should be updated or better deleted.

    • This reply was modified 1 week, 1 day ago by kranate.
    • This reply was modified 1 week, 1 day ago by kranate.
    Plugin Author Fahad Mahmood


    Ok, i will consider it.

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.