WC Rest Api create order not creating suborder for WCMP Vendor

Theme and Plugin Support

WC Rest Api create order not creating suborder for WCMP Vendor Open

Viewing 14 reply threads
  • Author
    Posts
    • #78904
      Alan Bird
      Participant

      I am connecting to WC through the WC API to “Create Order” for a product linked to a vendor, but this does create the sub-order automatically for the vendor account and therefore not showing on the vendor dashboard.

      Please see the “create order” call below. Are there any WCMP meta that should be added to facilitate the flow in this call to create the suborder for the vendor?

      {
      “payment_method”: “peach-payments”,
      “payment_method_title”: “Credit Card”,
      “billing”: {
      “first_name”: “John”,
      “last_name”: “Doe”,
      “address_1”: “969 Market”,
      “address_2”: “”,
      “city”: “San Francisco”,
      “state”: “CA”,
      “postcode”: “94103”,
      “country”: “US”,
      “email”: “john.doe@example.com”,
      “phone”: “(555) 555-5555”
      },
      “shipping”: {
      “first_name”: “John”,
      “last_name”: “Doe”,
      “address_1”: “969 Market”,
      “address_2”: “”,
      “city”: “San Francisco”,
      “state”: “CA”,
      “postcode”: “94103”,
      “country”: “US”
      },
      “line_items”: [
      {
      “product_id”: 1935,
      “quantity”: 1,
      }
      ],
      }

    • #79094

      Hi @Alan Bird, our team is looking into this.

      Kindly provide us sometime. I will keep you posted.

    • #83353
      hakang
      Participant

      I have the same problem. I can not create an order with the vendor key and values. The order is successfully created with Rest-api and I can see the order in the woocommerce orders in admin but I can see two separate orders are created. In the Postman; They are completely two different orders with different order_keys. The parent_id s are not attached. The meta_data does not have the Vendor information. So how can we attach the vendor to the order when its created. Update the meta will be a workaround in this case. There is no connection between the two newly created orders. I couldn’t figure it out how to trigger this.

    • #83457
      hakang
      Participant

      I ended up doing something like this. It’s really not the proper way but I am able to do what I want. I have a checkout.ts file. I create the order in app and get the order it from rest api then send the order id to the server. I assume you can create the order in php. my logic was created that way… Then in my php file I added these lines

      $new_vendor_order = new WCMp_Order();
      $new_vendor_order->wcmp_create_orders($order_id, $posted_data, $order, $backend = false) ;

      They were already in class-wc-stripe-customer.php. It needs some arguments but I am sure you will figure it out. Someone with same problem can explain this better than me but for now I guess its a starting point. The $posted_data there is amount, currency, description but you’ll figure it out.
      public function create_customer( $args = array() )

      In my Postman I am able to see The orders are connected to each other. one order key is empty but from this point it will be easy to tie it to the vendor.
      [
      {
      “id”: 18148,
      “parent_id”: 18147,
      ……

      {
      “id”: 18147,
      “parent_id”: 0,

    • #83934

      @hakang, our team is checking this.

      Kindly provide them sometime.

    • #84520

      @Alan Bird, @hakang, You can track the progress of this issue here – https://github.com/wcmarketplace/dc-woocommerce-multi-vendor/issues/176

      • #84656
        hakang
        Participant

        Thx. Moumita.

    • #85082
      hakang
      Participant

      I have tried commit 127073f and couldn’t make it work. Any suggestions?

    • #85166
      MOUMITA Haldar
      Participant

      @Hakang,

      Kindly check the codes on how to commit an issue in github.

      For further help, you may follow this link – https://help.github.com/en/github/managing-files-in-a-repository/adding-a-file-to-a-repository-using-the-command-line

    • #85757
      hakang
      Participant

      What do you mean? I didn’t want to commit an issue in github. Please clarify.

    • #85762

      @Hakang, sorry for the misunderstanding, we presumed you tried to commit the fix from your end also.

      We have already added the commit, our lead developer is checking this.

      Once everything will be okay, he will commit the code.

    • #86413

      @Alan Bird, @hakang, We have added the fix in our last git update: https://github.com/wcmarketplace/dc-woocommerce-multi-vendor/issues/152

      So, after downloading the plugin from here – https://github.com/wcmarketplace/dc-woocommerce-multi-vendor/archive/master.zip, follow these steps :

      – Delete the installed WC Marketplace via wp-admin >> plugin
      – Unzip the GitHub plugin
      – Rename the folder as “dc-woocommerce-multi-vendor” and remove the master tag. Now, zip this folder again.
      – Install this plugin on your site.

      We will release the same in our next update also.

    • #85849
      hakang
      Participant

      Moumita I have already tried those code changes/updates in github. That didn’t work for me. Are you sure this new update is working?

      HERE: https://github.com/cool-raju/dc-woocommerce-multi-vendor/commit/127073fdb19ed94af1489664986de1eecfd3940e
      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.

      and here: https://github.com/wcmarketplace/dc-woocommerce-multi-vendor/issues/176

    • #96186
      Gaurav Bordoloi
      Participant

      Hello, I just tried to create an order with the following body :

      {
      “status”: “pending”,
      “currency”: “INR”,
      “customer_id”: 0,
      “customer_note”: “Please pack the items with care. Last time, my butter got melted.”,
      “billing”: {
      “first_name”:”Dharma”,
      “last_name”: “Bordoloi”,
      “address_1”: “House 24, Gotanagar, Tetilia”,
      “address_2”: “Near Heritage School”,
      “city”: “Guwahati”,
      “state”: “Assam”,
      “postcode”:”781011″,
      “country”:”IN”,
      “email”:”dharma514@gmail.com”,
      “phone”:”9101750676″
      },
      “shipping”: {
      “first_name”:”Dharma”,
      “last_name”: “Bordoloi”,
      “address_1”: “House 24, Gotanagar, Tetilia”,
      “address_2”: “Near Heritage School”,
      “city”: “Guwahati”,
      “state”: “Assam”,
      “postcode”:”781011″,
      “country”:”IN”
      },
      “payment_method”: “paytm”,
      “payment_method_title”: “Paytm”,
      “line_items”: [
      {
      “product_id”:2850,
      “variation_id”:2856,
      “quantity”:3
      },
      {
      “product_id”:4777,
      “quantity”:2
      }
      ]
      }

      But suborder is not being created. What mistake am I doing?

    • #96284
      Gaurav Bordoloi
      Participant

      This fix is not working. Any solution for it to work?

    • #96888

      @Gaurav Bordoloi, we have responded in your other thread

Viewing 14 reply threads

Please LOGIN to reply to this topic

Buy any WCMp product at 20% discount, use code "FREEDOM20" or, buy bundle at a slashed price

Buy at Slashed Price