wcfm-santa

Making Christmas merrier with our special gift! Enjoy upto 25% off on all WCFM Addons.

CLAIM OFFER
01Day 03Hr 46Min 33Sec

inserting order using Rest API

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Viewing 12 reply threads
  • Author
    Posts
    • #64262
      MarsMars
      Participant

      Hello,
      I am inserting orders using API from a customer mobile APP.
      the issue of how should I insert the vendor info in the order JSON. so the vendor will be able to see the order in his/her panel?

      Regards,

    • #65227
      WCFM Forum
      Member

      Hi,

      Do you have created this yet?

      If you create order in WooCommerce, vendor order will automatically created and all vendor information will set on those.

      Thank You

    • #65281
      MarsMars
      Participant

      I did create an order it did not add the vendor info
      I can see the order only in the admin panel not the vendor panel

    • #65387
      MarsMars
      Participant

      this is my payload,, I am not sure why I cannot see it in the vendor panel is there something missing in the order post

      {
          "customer_id": 46,
          "set_paid": true,
          "payment_method": "cod",
          "payment_method_title": "Cash on delivery",
          "status": "processing",
          "billing": {
            "first_name": "Nishant",
            "last_name": "Desai",
            "company": "",
            "address_1": "",
            "address_2": "",
            "city": "",
            "state": "",
            "postcode": "",
            "email": "abcd@gmail.com",
            "phone": "(12) 3456-7890"
          },
          "shipping": {
            "first_name": "Nishant",
            "last_name": "Desai",
            "address_1": "",
            "city": "",
            "state": "",
            "postcode": ""
          },
          "line_items": [
            {
              "product_id": 83,
              "quantity": 1,
              "subtotal": "800",
              "total": "800",
              "meta_data": [
                {
                  "key": "خيارات (100ر.س)",
                  "value": "قصير"
                },
                {
                  "key": "Location",
                  "value": "home"
                },
                 {
                       
                          "key": "_vendor_id",
                          "value": "2"
                      }
              ],
              "appointments": {
                "shop_name": "MARIAM",
                "_appointment_start": 1558859400000,
                "_appointment_end": 1558863000000
              }
            }
          ],
       
          "meta_data": [
            {
              "key": "client_longitude",
              "value": 72.8255146
            },
            {
              "key": "client_latitude",
              "value": 21.1933855
            }
          ],
          "fee_lines": [
           {
               
                  "name": "الدفع نقدًا عند الإستلام",
                  "tax_class": "0",
                  "tax_status": "taxable",
                  "amount": "15",
                  "total": "15.00",
                  "total_tax": "0.00",
                  "taxes": [],
                  "meta_data": []
              }
              ]
        }
      
    • #65399
      WCFM Forum
      Member

      HI,

      Kindly show me that order details page screenshot.

      We are checking this as well.

      Thank You

    • #68312
      MarsMars
      Participant

      Hi,
      I am testing using the woocommerce rest api .. so the above is the payload I sent .. this was my question I want to create a customer app and I want to create an order .. when creating the order I do not see it in the vendor panel .. I think I need to do extra thing maybe adding hooks or adding something to the payload json ,, so as a vendor I can see that order in my panle
      Regards,

    • #68457
      MarsMars
      Participant

      removed

    • #68460
      MarsMars
      Participant

      I made a progress but I am not sure if this is completely correct of there is something missing

      this is added to the function.php

      
      add_action( 'woocommerce_rest_insert_shop_order_object',  'wcfmmp_checkout_order_processed2');
      function wcfmmp_checkout_order_processed2( $order ) {
           global $WCFMmp;
      	 $order_id = $order->get_id();
      		$WCFMmp->wcfmmp_commission->wcfmmp_checkout_order_processed( $order_id );
       }

      Please guide if something missing .. also I noticed when the order status is processing I see the refund button but when the order is completed I do not see it this is only with rest inserted orders .. but for orders inserted online it is the other way around

    • #68936
      WCFM Forum
      Member

      Hi,

      Is this code working for you ?

      Where you get this hook – “woocommerce_rest_insert_shop_order_object”

      Thank You

    • #69035
      MarsMars
      Participant

      I found it in some tutorials online referring to it
      Is there issue with it?
      Can you please answer my questions above?

    • #69743
      WCFM Forum
      Member

      Well, WooCommerce does not have any such hook right now.

      Do you require addition code for generating vendor orders?
      Is this not generating when you are creating WC order using API!

      Thank You

    • #69750
      MarsMars
      Participant

      it is inserting orders
      but my questions were: do I need to use something else? with this one
      the issue I am facing is with the refund.. refund button should be shown only if the order is completed .. as the order inserted via web page
      orders inserted from rest I see the refund button even if payment status is false and when I change the order to complete the refund button disappear. while orders inserted from the web it is different,, I see refund button only for completed orders
      the other thing.. I think this command does not generate withdrawals automatically like orders inserted from the web , that’s why I am asking what other commands I need to run to ensure orders are inserted completely.
      Regards

    • #69927
      WCFM Forum
      Member

      HI,

      Can you please show me your “Withdrawal Setting” screenshot.

      What is your setting for “Order Sync” at WCFM Admin Setting -> Marketplace setting ?

      Thank You

Viewing 12 reply threads
  • You must be logged in to reply to this topic.