Skip to content

Commit

Permalink
Fixed issue #176
Browse files Browse the repository at this point in the history
  • Loading branch information
cool-raju committed Dec 4, 2019
1 parent 557a910 commit 127073f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions classes/class-wcmp-order.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public function __construct() {
add_action('woocommerce_saved_order_items', array(&$this, 'wcmp_create_orders_from_backend'), 10, 2 );
add_action('woocommerce_checkout_order_processed', array(&$this, 'wcmp_create_orders'), 10, 3);
add_action('woocommerce_after_checkout_validation', array($this, 'wcmp_check_order_awaiting_payment'));
add_action( 'woocommerce_rest_insert_shop_order_object',array(&$this, 'wcmp_create_suborder_through_rest_api'), 10, 3 );
// Order Refund
add_action('woocommerce_order_refunded', array($this, 'wcmp_order_refunded'), 10, 2);
add_action('woocommerce_refund_deleted', array($this, 'wcmp_refund_deleted'), 10, 2);
Expand Down Expand Up @@ -296,6 +297,11 @@ public function wcmp_create_orders_from_backend( $order_id, $items ){
$this->wcmp_create_orders($order_id, array(), $order, true);
}

public function wcmp_create_suborder_through_rest_api( $order, $response, $request ) {
global $WCMp;
$this>wcmp_create_orders($order->get_id(), array(), $order, true);
}

/**
* Create a new vendor order programmatically
*
Expand Down

1 comment on commit 127073f

@hakangoker
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have modified the file and uploaded to my server. I have created a WC Rest-Api order. I don't see suborder created in admin. There are two new orders and one of them is $0 amount. In postman I can see two different orders are created and parent Id is not attached. Am I doing something wrong. I was hoping to see the suborder attached to the main order as it happens on website.

Please sign in to comment.