Product Price by Quantity

Options
brian
brian Administrator

ADMIN

Set your product prices based on the quantity of items ordered.

It features:

  • GET /product_price - find the price for a product using the inputs of product_id and quantity.
  • GET /create_product - create a new product and set as many prices you want for a quantity range using a JSON object.
  • TABLE product - to set the product's name.
  • TABLE price - to set the price for a product based on a quantity range.

You can use this snippet to learn how to:

  • Use a function to populate data based on business logic built into your API
  • Iterate through an array using a variable (array_index) for faster testing
  • Use Database Transaction to protect your database from errors, by only uploading a new product if every price range was successfully set

Feel free to add suggestions, requests, or questions in the comments!