MasterProductOffers (Common Products for Vendors)

MasterProductOffers are the offers of a specific common product. This entity is added by the Common Products for Vendors add-on that is available in Multi-Vendor.

Get Product Offers

To get a list of all offers of a specific common product, send a GET request to /api/master_products/:id/master_product_offers. For example:

GET /api/master_products/310/master_product_offers

To get a specific product offer, send the same request with the ID of the offer. For example:

GET /api/master_products/310/master_product_offers/313

Pagination, Sorting and Filtering

Pagination, sorting, and filtering parameters are inherited from Products.

The Common Products for Vendors add-on adds the show_master_products_only filtering parameter with true or false value, available via Products API.

The true value will return only common products in the response, while the false will return only products offered by vendors.

Response Format

Field name Values Description
master_product_id integer ID of a common product to which the product belongs
master_product_status
A
D
H
The status of a common product to which the product belongs:
A for Active
D for Disabled
H for Hidden
master_product_offers_count integer The current number of product offers that the common product has

Create a Product Offer

To add a new offer of a common product, you need to specify the ID of the common product and the id of the vendor that will sell the product. Send a POST request to /api/master_products/:id/master_product_offers with the company_id field in JSON.

Example

POST /api/master_products/310/master_product_offers

Example JSON

{
    "company_id": "1"
}

This request creates a product offer of a common product with the id 310 for the vendor with the ID 1.

Response Format

  • The product offer has been created successfully: HTTP/1.1 201 Created and the JSON with the new product_id:
{
   "product_id": 310
}
  • The product couldn’t be created: HTTP/1.1 400 Bad Request.

Update a Product Offer

Once a product offer is created, you can update its price, quantity, and other details. To update an existing product offer, send the PUT request to /api/master_products/:id/master_product_offers/:id. For example:

PUT /api/master_product/310/master_product_offers/313

Example JSON

{
    "price": "100",
    "amount": "5"
}

This request updates the price and quantity of the product offer.

Response Format

  • The product has been updated successfully: HTTP/1.1 200 OK and JSON with product_id.
  • The product couldn’t be updated: HTTP/1.1 400 Bad Request.
  • The product does not exist: HTTP/1.1 404 Not Found.

Delete a Product Offer

To delete a product, send a DELETE request to /api/master_products/:id/master_product_offers/:id. For example:

DELETE /api/master_products/310/master_product_offers/313

This request will delete the product offer with the ID 313.

Response Format

  • The product has been deleted successfully: HTTP/1.1 204 No Content.
  • The product does not exist: HTTP/1.1 404 Not Found.
  • The product couldn’t be deleted: HTTP/1.1 400 Bad Request.

Big CS-Cart Update is Here Experience the New Admin Panel with Dark Theme