Products
The products API allows you to create, view, update, and delete a wholesale product.
Note that you can still use wc product properties set in WC API since our API is just extending from WC.
Available Routes:
GET: wholesale/v1/products
GET: wholesale/v1/products/{product_id}
POST: wholesale/v1/products
PUT: wholesale/v1/products/{product_id}
DELETE: wholesale/v1/products/{product_id}
POST: wholesale/v1/products/batch
Wholesale Data Property
To get wholesale related data, it can be accessed using the property wholesale_data
in the response.
Ex. Request:
GET: http://example.com/wp-json/wholesale/v1/products?wholesale_role=wholesale_customer
Ex. Response:
{
"id": 3419,
"type": "simple",
{...wc product props},
"wholesale_data": {
"wholesale_price": {
"wholesale_customer": "80",
},
"price_html": "<del class=\"original-computed-price\"><span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">$</span>100.00</bdi></span></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>80.00</bdi></span> <small class=\"woocommerce-price-suffix wholesale-price-suffix\"></small></ins>\r\n </span>"
}
}
Note: The price_html
data will only show up if wholesale role is provided. The price_html
contains the regular + wholesale price in html format. If not a wholesale product, it will show the regular price in html format.
Last updated
Was this helpful?