Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Ultimate › inserting order using Rest API
- This topic has 12 replies, 2 voices, and was last updated 5 years, 6 months ago by WCFM Forum.
- AuthorPosts
- May 29, 2019 at 9:27 am #64262MarsMarsParticipant
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,
- May 31, 2019 at 6:51 pm #65227WCFM ForumMember
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
- May 31, 2019 at 8:09 pm #65281MarsMarsParticipant
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 - June 1, 2019 at 7:36 am #65387MarsMarsParticipant
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": [] } ] }
- June 1, 2019 at 9:15 am #65399WCFM ForumMember
HI,
Kindly show me that order details page screenshot.
We are checking this as well.
Thank You
- June 18, 2019 at 12:02 pm #68312MarsMarsParticipant
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, - June 18, 2019 at 7:09 pm #68457MarsMarsParticipant
removed
- June 18, 2019 at 7:35 pm #68460MarsMarsParticipant
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
- June 21, 2019 at 6:49 pm #68936WCFM ForumMember
Hi,
Is this code working for you ?
Where you get this hook – “woocommerce_rest_insert_shop_order_object”
Thank You
- June 22, 2019 at 9:47 am #69035MarsMarsParticipant
I found it in some tutorials online referring to it
Is there issue with it?
Can you please answer my questions above? - June 26, 2019 at 12:52 pm #69743WCFM ForumMember
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
- June 26, 2019 at 1:09 pm #69750MarsMarsParticipant
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 - June 27, 2019 at 4:32 am #69927WCFM ForumMember
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
- AuthorPosts
- You must be logged in to reply to this topic.