Adding a custom product field to order details for RestAPI Woocommerce

Viewed 17

It's my first time posting so I hope I'll do it right;

I'm building a multivendor platform but without all the multivendor plugins and for this I need to register successful orders. With this info I can calculate the admin fees for the different vendors. Right now I'm using the Make.com (Integromat) to sync all the orders from Woocommerce to Monday.com using Woocommerce's REST API. But I've got a problem...

An order from one customer can contain multiple items from different vendors. Example:

Order:

  • 1x Cheese --> from Farmer A
  • 2x Apples --> from Farmer B
  • 1x Milk --> from Farmer C

Picture results Monday.com

As you can see in the picture I've got Woocommerce syncing with Monday.com for the basic order info. Now I just need a way to add the custom field "Supplier", that I added to each Woo Product, to show up in the line items of the order/checkout screen, but also sync to Monday.com using Make.com.

I'm a total code noob and I've been watching REST API and Postman videos like a mad man, but without results. Is there anybody who can point me in the right direction?

Breakdown question:

  • add meta field "supplier" to orders line items
  • sync "suppliers" shown in cart to Monday.com via Make.com using REST API

Any help would be greatly appreciated!

1 Answers

I am very new to this so someone else may come out with a better answer. The thing i would look at is using Datastores, so you would create a structure including the supplier field that you can then map, and it feeds into this. You can then fetch your data store, each line would now have a key which you could use the names of the farmers for example so it groups them together no matter which suppliers they used. After which you can do your other bits to tidy up and map into make? Could be wrong but hope this helps amigo!

Related