GET: /wp-json/wholesale/v1/products/{variable_id}/variations/{variation_id}?wholesale_role=wholesale_customer&return_wholesale_products=true
Response:
{
"id": 7049,
"date_created": "2021-10-20T03:46:17",
"date_created_gmt": "2021-10-20T03:46:17",
"date_modified": "2021-10-20T13:03:36",
"date_modified_gmt": "2021-10-20T13:03:36",
"description": "",
"permalink": "https://example.com/product/variable-test/?attribute_pa_color=green",
"sku": "",
"price": "20",
"regular_price": "20",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_from_gmt": null,
"date_on_sale_to": null,
"date_on_sale_to_gmt": null,
"on_sale": false,
"status": "publish",
"purchasable": true,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"stock_status": "instock",
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"low_stock_amount": null,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_class": "",
"shipping_class_id": 0,
"image": null,
"attributes": [
{
"id": 1,
"name": "Color",
"option": "Green"
}
],
"menu_order": 2,
"wholesale_data": {
"wholesale_price": {
"wholesale_customer": "16"
},
"wholesale_sale_price": {
"wholesale_customer": "14"
},
"price_html": "<del class=\"original-computed-price\"><span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">$</span>20.00</bdi></span> <small class=\"woocommerce-price-suffix\">inc. VAT</small></del><span style=\"display: block;\" class=\"wholesale_price_container\">\r\n <span class=\"wholesale_price_title\">Wholesale Price:</span>\r\n <ins><span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">$</span>16.00</bdi></span> <small class=\"woocommerce-price-suffix wholesale-price-suffix\">inc. VAT</small></ins>\r\n </span>"
}
}
The wholesale role key is invalid.
GET: /wp-json/wholesale/v1/products/{variation_id}/variations/{variation_id}?wholesale_role=invalid_role
Response:
{
"code": "wholesale_rest_product_cannot_view",
"message": "Invalid wholesale role.",
"data": {
"status": 400
}
}