DescriptionThis API lets you retrieve and view all orders or a specific order by ID.
WooCommerce B2B Sales Agents available meta fields:
- wcb2bsa_sales_agent: contains assigned sales agent ID when order placed.
Value is an integer number
In API GET response, has also a dedicated field alias named "wcb2bsa_sales_agent" - wcb2bsa_order_item_types_eligible_for_commission: contains item types on which commissions can be applied and calculated when order placed.
Value is an associative array with ITEM TYPE as key and enabled flag as value (it's a tinyint number, 0 (=disabled) or 1 (=enabled)).
In API GET response, has also a dedicated field alias named "wcb2bsa_order_item_types_eligible_for_commission" - wcb2bsa_created_by: contains who created the order.
Value is a string, can be "customer", "sales_agent", "admin"
In API GET response, has also a dedicated field alias named "wcb2bsa_created_by"
Each "line_items" contains specific meta fields:
- wcb2bsa_item_commission: contains single item percentage commission when order placed.
Value is an floating number - wcb2bsa_custom_price: contains if item price has been altered and customized by sales agent in cart when order placed.
Value is a boolean
Note: WooCommerce B2B Sales Agents extends default WooCommerce products REST API with own custom meta fields. For more informations, please visit: WooCommerce Official documentation
HTTP request (all orders) HTTP request (single order) get
/wp-json/wc/v3/orders/{ID}
Example response
{
"id": 101,
"parent_id": 0,
"number": "101",
"order_key": "wc_order_AZ59JpOFpEQcv",
"created_via": "checkout",
"version": "4.3.0",
"status": "completed",
"currency": "USD",
"date_created": "2020-06-13T02:00:0",
"date_created_gmt": "2020-06-13T00:00:0",
"date_modified": "2020-06-13T02:00:0",
"date_modified_gmt": "2020-06-13T00:00:0",
"discount_total": "0.00",
"discount_tax": "0.00",
"shipping_total": "20.00",
"shipping_tax": "4.40",
"cart_tax": "51.12",
"total": "307.90",
"total_tax": "55.52",
"prices_include_tax": true,
"customer_id": 2,
"customer_ip_address": "***",
"customer_user_agent": "***",
"customer_note": "",
"billing": {
"first_name": "John",
"last_name": "Doe",
"company": "Google LLC",
"address_1": "Central Park, 1",
"address_2": "",
"city": "New York",
"state": "NY",
"postcode": "10001",
"country": "US",
"email": "customer@woocommerce-b2b.com",
"phone": "2122236457"
},
"shipping": {
"first_name": "John",
"last_name": "Doe",
"company": "Google LLC",
"address_1": "Central Park, 1",
"address_2": "",
"city": "New York",
"state": "NY",
"postcode": "10001",
"country": "US"
},
"payment_method": "bacs",
"payment_method_title": "Direct bank transfer",
"transaction_id": "",
"date_paid": "2020-06-13T02:00:0",
"date_paid_gmt": "2020-06-13T00:00:0",
"date_completed": "2020-06-13T02:00:0",
"date_completed_gmt": "2020-06-13T00:00:0",
"cart_hash": "4c4d2a2498f758a949a05f83a439b8e5",
"meta_data": [
{
"id": 1068,
"key": "wcb2bsa_sales_agent",
"value": "3"
},
{
"id": 1069,
"key": "wcb2bsa_order_item_types_eligible_for_commission",
"value": {
"line_item": "1",
"fee": "1",
"shipping": "1"
}
},
{
"id": 1487,
"key": "wcb2bsa_created_by",
"value": "sales_agent"
}
],
"line_items": [
{
"id": 9,
"name": "Hoodie - Blue, Yes",
"product_id": 12,
"variation_id": 35,
"quantity": 7,
"tax_class": "",
"subtotal": "232.38",
"subtotal_tax": "51.12",
"total": "232.38",
"total_tax": "51.12",
"taxes": [
{
"id": 1,
"total": "51.12",
"subtotal": "51.12"
}
],
"meta_data": [
{
"id": 82,
"key": "pa_color",
"value": "blue",
"display_key": "Color",
"display_value": "Blue"
},
{
"id": 83,
"key": "logo",
"value": "Yes",
"display_key": "Logo",
"display_value": "Yes"
},
{
"id": 84,
"key": "wcb2bsa_item_commission",
"value": "10",
"display_key": "wcb2bsa_item_commission",
"display_value": "10"
},
{
"id": 1933,
"key": "wcb2bsa_custom_price",
"value": "true",
"display_key": "wcb2bsa_custom_price",
"display_value": "true"
}
],
"sku": "woo-hoodie-blue-logo",
"price": 33.19672128571428,
"parent_name": "Hoodie"
}
],
"tax_lines": [
{
"id": 11,
"rate_code": "TAX-1",
"rate_id": 1,
"label": "Tax",
"compound": false,
"tax_total": "51.12",
"shipping_tax_total": "4.40",
"rate_percent": 22,
"meta_data": [
{
"id": 98,
"key": "wcb2bsa_item_commission",
"value": "10",
"display_key": "wcb2bsa_item_commission",
"display_value": "10"
}
]
}
],
"shipping_lines": [
{
"id": 10,
"method_title": "Flat rate",
"method_id": "flat_rate",
"instance_id": "2",
"total": "20.00",
"total_tax": "4.40",
"taxes": [
{
"id": 1,
"total": "4.4",
"subtotal": ""
}
],
"meta_data": [
{
"id": 90,
"key": "Products",
"value": "Hoodie - Blue, Yes × 7",
"display_key": "Products",
"display_value": "Hoodie - Blue, Yes × 7"
},
{
"id": 91,
"key": "wcb2bsa_item_commission",
"value": "10",
"display_key": "wcb2bsa_item_commission",
"display_value": "10"
}
]
}
],
"fee_lines": [],
"coupon_lines": [],
"refunds": [],
"currency_symbol": "$",
"wcb2bsa_sales_agent": 3,
"wcb2bsa_order_item_types_eligible_for_commission": {
"line_item": "1",
"fee": "1",
"shipping": "1"
},
"wcb2bsa_created_by": "sales_agent",
"_links": {
"self": [
{
"href": "https://demo.woocommerce-b2b.com/sales-agents/wp-json/wc/v3/orders/101"
}
],
"collection": [
{
"href": "https://demo.woocommerce-b2b.com/sales-agents/wp-json/wc/v3/orders"
}
],
"customer": [
{
"href": "https://demo.woocommerce-b2b.com/sales-agents/wp-json/wc/v3/customers/2"
}
]
}
}