Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

253
Vistas
E-commerce Database design: Products with optional variations and scaled prices

For a client, I'm trying to build a minimal e-commerce system. It's going to have products which may have variations (think S, M, L) and every variation may have a scaled price system depending on the amount the client orders:

  • 1 shirt, size L = 10 EUR each
  • 5 shirts, size L = 9 EUR each
  • 1 shirt, size S = 8 EUR each
  • 5 shirts, size S = 7 EUR euch

But there may also be products without variations and a fixed price:

  • n pullovers = 50 EUR each

And products which have no variations but a scaled price system:

  • 1 trouser = 100 EUR each
  • 5 trousers = 90 EUR each

I was thinking about the following db schema:

products

  • id
  • description
  • ...

product_variations

  • id
  • product_id
  • variation_id (table with all possible variations: color, size, etc.)
  • value (l, m, red, green)

product_prices

  • id
  • product_id
  • product_variation_id (can be null, if the price is for the product, not a variation)
  • priceNet
  • tax
  • qualify_amount (minimum number of items the customer has to order to qualify for this price, defaults to 1)

Is it okay to make product_variation_id nullable to achieve the wanted flexibility in combinations between prices and variations without having to add at least one (standard) variation for every product (when the product doesn't have variations)? Any better ideas? :)

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda