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 (Premium)

Variations

The wholesale role API allows you to create, view, update, and delete wholesale variations.

Note that you can still use wc product properties set in WC API since our API is just extending from WC.

Note that you need to create the variable parent first via wholesale/v1/products endpoint before you can use this endpoint.

Available Routes:

  • GET: wholesale/v1/products/{variable_id}/variations

  • GET: wholesale/v1/products/{variable_id}/variations/{variation_id}

  • POST: wholesale/v1/products/{variable_id}/variations

  • PUT: wholesale/v1/products/{variable_id}/variations/{variation_id}

  • DELETE: wholesale/v1/products/{variable_id}/variations/{variation_id}

  • POST: wholesale/v1/products/{variable_id}/variations/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/4303/variations/4306?wholesale_role=wholesale_customer

Ex. Response:

{
    "id": 3419,
    {...wc variation 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\">&#36;</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\">&#36;</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.

PreviousBatch Update ProductsNextList All Wholesale Variations

Last updated 3 years ago

Was this helpful?