DescriptionThis API lets you retrieve and view all products or a specific product by ID.
WooCommerce B2B Warehouses available meta fields:
- wcb2bw_product_warehouses: contains dedicated stocks by warehouse.
Value is a multidimensional array with WAREHOUSE ID as key and associative subarray:- stock: dedicated warehouse stock. It's an integer number
- priority: warehouse sorting priority to reduce quantity in case of order. It's an integer number
In API GET response, has also a dedicated field alias named "wcb2bw_product_warehouses"
Note: WooCommerce B2B Warehouses extends default WooCommerce products REST API with own custom meta fields. For more informations, please visit: WooCommerce Official documentation
HTTP request (all products) get
/wp-json/wc/v3/products
HTTP request (single product) get
/wp-json/wc/v3/products/{ID}
Example response
{
"id": 60,
"name": "T-Shirt with Logo",
"slug": "t-shirt-with-logo",
"permalink": "https://demo.woocommerce-b2b.com/product/t-shirt-with-logo/",
"date_created": "2020-06-13 00:00:00",
"date_created_gmt": "2020-06-13 00:00:00",
"date_modified": "2020-06-13 00:00:00",
"date_modified_gmt": "2020-06-13 00:00:00",
"type": "simple",
"status": "publish",
"featured": false,
"catalog_visibility": "visible",
"description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>\n",
"short_description": "<p>This is a simple product.</p>\n",
"sku": "Woo-tshirt-logo",
"price": "98",
"regular_price": "100",
"sale_price": "98",
"date_on_sale_from": null,
"date_on_sale_from_gmt": null,
"date_on_sale_to": null,
"date_on_sale_to_gmt": null,
"price_html": "<del><span class=\"woocommerce-Price-amount amount\"><span class=\"woocommerce-Price-currencySymbol\">$</span>100.00</span></del> <ins><span class=\"woocommerce-Price-amount amount\"><span class=\"woocommerce-Price-currencySymbol\">$</span>98.00</span></ins>",
"on_sale": true,
"purchasable": true,
"total_sales": 0,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": 0,
"download_expiry": 0,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"stock_status": "instock",
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"sold_individually": false,
"weight": "",
"dimensions": {
"length": "10",
"width": "12",
"height": "0.5"
},
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": true,
"average_rating": "0.00",
"rating_count": 0,
"related_ids": [
50,
40,
43,
51
],
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 0,
"purchase_note": "",
"categories": [
{
"id": 20,
"name": "Tshirts",
"slug": "tshirts-clothing"
}
],
"tags": [],
"images": [
{
"id": 83,
"date_created": "2020-06-13 00:00:00",
"date_created_gmt": "2020-06-13 00:00:00",
"date_modified": "2020-06-13 00:00:00",
"date_modified_gmt": "2020-06-13 00:00:00",
"src": "https://demo.woocommerce-b2b.com/wp-content/uploads/2020/06/t-shirt-with-logo-1.jpg",
"name": "t-shirt-with-logo-1.jpg",
"alt": ""
}
],
"attributes": [
{
"id": 1,
"name": "Color",
"position": 0,
"visible": true,
"variation": false,
"options": [
"Gray"
]
}
],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"meta_data": [
{
"id": 967,
"key": "_wpcom_is_markdown",
"value": "1"
},
{
"id": 263305,
"key": "wcb2bw_product_warehouses",
"value": {
"1157": {
"priority": 0,
"stock": 10
},
"1159": {
"priority": 2,
"stock": 20
},
"1161": {
"priority": 1,
"stock": 5
}
}
}
],
"wcb2bw_warehouse_stocks": [
{
"1157": {
"priority": 0,
"stock": 10
},
"1159": {
"priority": 2,
"stock": 20
},
"1161": {
"priority": 1,
"stock": 5
}
}
],
"_links": {
"self": [
{
"href": "https://demo.woocommerce-b2b.com/wp-json/wc/v3/products/60"
}
],
"collection": [
{
"href": "https://demo.woocommerce-b2b.com/wp-json/wc/v3/products"
}
]
}
}