Identify B2B and web orders through JSON payload

Identify B2B and web orders through JSON payload

yohanr8
Shopify Partner
1 0 0

How can I identify if an order is B2B or web from order JSON payload?

Replies 3 (3)

zack1605
Visitor
1 0 0

I utilize Shopify Flow to auto-tag all B2B Orders with "wholeseller" and filter from there. 

 

WHEN order is created THEN Check IFCompany is not empty and exists THEN add "wholeseller" tag to the order

 

Contains order tag "wholeseller" = B2B

Doesn't contain order tag "wholeseller" = WEB

FutureAndAHope
Shopify Partner
51 3 19

I liked this idea because it would help with other things we were doing. But when I went to flow I could not see the field "Company". Are you sure it exists?

FutureAndAHope
Shopify Partner
51 3 19
{
  "order": {
    "id": 5626252099639,
    ....
    "company": {
      "id": 84410423,
      "location_id": 85491767
    }
    ....
}

If the "company" field has and "id" and "location_id" then it is a B2B order. Otherwise, it is retail, and "company" has a null value.