Wholesale Suite API
  • REST API
  • wholesale/v1 (Free)
    • Products
      • List All Wholesale Products
      • Retrieve a Wholesale Product
      • Create a Wholesale Product
      • Update a Wholesale Product
      • Delete a Wholesale Product
      • Batch Update Products
    • Variations
      • List All Wholesale Variations
      • Retrieve a Wholesale Variation
      • Create a Wholesale Variation
      • Update a Wholesale Variation
      • Delete a Wholesale Variation
      • Batch Update Variations
    • Wholesale Role
      • List Wholesale Roles
      • Retrieve a Wholesale Role
      • Update a Wholesale Role
  • wholesale/v1 (Premium)
    • Products
      • List All Wholesale Products
      • Retrieve a Wholesale Product
      • Create a Wholesale Product
      • Update a Wholesale Product
      • Delete a Wholesale Product
      • Batch Update Products
    • Variations
      • List All Wholesale Variations
      • Retrieve a Wholesale Variation
      • Create a Wholesale Variation
      • Update a Wholesale Variation
      • Delete a Wholesale Variation
      • Batch Update Variations
    • Wholesale Role
      • List Wholesale Roles
      • Retrieve a Wholesale Role
      • Create a Wholesale Role
      • Update a Wholesale Role
      • Delete a Wholesale Role
    • Category Discounts
      • List Category Discounts
      • Retrieve Category Discount
      • Create Category Discount
      • Update Category Discount
      • Delete Category Discount
    • General Discounts
      • List General Discounts
      • Retrieve Specific Role Discount
      • Create a General Discount
      • Update a general Discount
      • Delete a General Discount
    • Bundle
      • Create Bundle Product
      • Batch Update
    • Composite
      • Create Composite Product
      • Batch Update
Powered by GitBook
On this page

Was this helpful?

  1. wholesale/v1 (Free)
  2. Products

Retrieve a Wholesale Product

This API handles fetching wholesale and non-wholesale product.

Method

Endpoint

GET

/wp-json/wholesale/v1/products/{product_id}

Query Parameters

Required

Type

Description

wholesale_role

no

string

The wholesale role key.

return_wholesale_products

no

boolean

Return only products with wholesale price. This parameter is dependent on the wholesale_role parameter. Default value is false.

show_categories

no

boolean

Whether show or hide wc categories property from the response. The prop is hidden by default using this api.

show_meta_data

no

boolean

Whether show or hide wc meta_data property from the response. The prop is hidden by default using this api.

Postman

Get the product:

GET: /wp-json/wholesale/v1/products/{product_id}

With wholesale role:

GET: /wp-json/wholesale/v1/products/{product_id}?wholesale_role=wholesale_customer

Return only if the product is wholesale:

GET: /wp-json/wholesale/v1/products/{product_id}?wholesale_role=wholesale_customer&return_wholesale_products=true

Status: 200 OK

Fetch Wholesale product data on a specific wholesale user.

GET: /wp-json/wholesale/v1/products/{product_id}?wholesale_role=wholesale_customer

Response:
{
    "id": 4291,
    "name": "Premium Quality",
    "slug": "premium-quality",
    "permalink": "https://example.com/product/premium-quality/",
    "date_created": "2021-03-14T16:12:15",
    "date_created_gmt": "2021-03-14T16:12:15",
    "date_modified": "2021-03-14T16:13:46",
    "date_modified_gmt": "2021-03-14T16:13:46",
    "type": "simple",
    "status": "publish",
    "featured": false,
    "catalog_visibility": "visible",
    "description": "",
    "short_description": "",
    "sku": "",
    "price": "21.99",
    "regular_price": "21.99",
    "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,
    "purchasable": true,
    "total_sales": 0,
    "virtual": false,
    "downloadable": false,
    "downloads": [],
    "download_limit": -1,
    "download_expiry": -1,
    "external_url": "",
    "button_text": "",
    "tax_status": "taxable",
    "tax_class": "",
    "manage_stock": false,
    "stock_quantity": null,
    "backorders": "no",
    "backorders_allowed": false,
    "backordered": false,
    "sold_individually": false,
    "weight": "",
    "dimensions": {
        "length": "",
        "width": "",
        "height": ""
    },
    "shipping_required": true,
    "shipping_taxable": true,
    "shipping_class": "",
    "shipping_class_id": 0,
    "reviews_allowed": true,
    "average_rating": "0.00",
    "rating_count": 0,
    "upsell_ids": [],
    "cross_sell_ids": [],
    "parent_id": 0,
    "purchase_note": "",
    "tags": [],
    "images": [],
    "attributes": [],
    "default_attributes": [],
    "variations": [],
    "grouped_products": [],
    "menu_order": 0,
    "price_html": "<span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">&#36;</span>21.99</bdi></span>",
    "related_ids": [
        4207,
        4279,
        4276,
        4104,
        4285
    ],
    "stock_status": "instock",
    "tax_amount": "2.20",
    "regular_display_price": "21.99",
    "sales_display_price": "21.99",
    "barcode": "",
    "wholesale_data": {
        "wholesale_price": {
            "wholesale_customer": "12"
        },
        "wholesale_sale_price": {
            "wholesale_customer": "10"
        },
        "price_html": "<del class=\"original-computed-price\"><span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">&#36;</span>21.99</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\">&#36;</span>12.00</bdi></span> <small class=\"woocommerce-price-suffix wholesale-price-suffix\"></small></ins>\r\n                                        </span>"
    }
}

Status: 400 Bad Request

The wholesale role key is invalid.

GET: /wp-json/wholesale/v1/products/{product_id}?wholesale_role=invalid_role

Response:
{
    "code": "wholesale_rest_product_cannot_view",
    "message": "Invalid wholesale role.",
    "data": {
        "status": 400
    }
}
PreviousList All Wholesale ProductsNextCreate a Wholesale Product

Last updated 11 months ago

Was this helpful?