Update menu (price)

Changed on

Cambia la configuración del menú. Cambiar priority, storesIds, channels, daysBefore o schedule cambia qué menú aplica en cada pedido y, con eso, los precios y productos que ven los clientes. Los precios de los productos se cambian en PUT /ecommerce/products/{productId}/menus/{menuId}.

Cómo funcionan los menús y precios

Un menú es una lista de precios: dice qué productos se venden y a qué precio. En el administrador se llama menú y en la API precio: cada menú es un registro de GET /ecommerce/prices, y su _id es el menuId que aparece en menus de cada producto. Una marca puede tener varios menús, por ejemplo uno general, uno para un local y uno de almuerzo.

1. Cada pedido usa un solo menú. Los menús no se mezclan: el cliente ve el precio y la disponibilidad que el producto tiene en el menú que se está usando.

2. Cómo se elige el menú en la tienda online. Se revisan los menús habilitados de mayor a menor priority y se usa el primero que cumple todas estas condiciones:

  • storesIds está vacío o incluye el local del pedido. Mientras no se sepa el local, los menús con locales no aplican.
  • channels está vacío o incluye el canal del pedido. Si el cliente aún no elige cómo recibir el pedido, se considera delivery.
  • schedule está abierto a la hora de entrega menos el tiempo de preparación del local, o ahora si el pedido no es programado. El horario solo restringe si availableAtPeriods es true; si no, el menú aplica a toda hora, salvo los días cerrados (closedDays).
  • Faltan al menos daysBefore días de calendario para esa fecha.
  • segmentIds está vacío, o el cliente inició sesión y pertenece a alguna de esas audiencias.

Si ningún menú cumple, se usa el menú por defecto (isDefault), aunque no cumpla sus condiciones. Si la marca no tiene menú por defecto, se usa el de mayor priority. Si la marca tiene un solo menú habilitado, se usa siempre.

3. Productos no disponibles. Si el producto no está disponible en el menú que se usa, no aparece en la tienda. Si en el administrador tiene un mensaje de no disponible, aparece con ese mensaje, pero no se puede comprar. Un producto tampoco aparece si tiene un modificador obligatorio sin opciones disponibles en ese menú. Agotado (out-of-stock) es otra cosa: se marca por local, y el producto aparece como agotado, salvo que la marca active Ocultar productos no disponibles o sin stock: entonces los agotados no aparecen.

4. Cada menú tiene su propio precio. Cambiar el precio en un menú no cambia los demás. Para cambiarlo en toda la marca, cámbialo en cada menú donde el producto está disponible. Para cambiarlo solo en un local, canal u horario, usa el punto 2 para saber qué menú se usa ahí.

5. Descuentos. discountPrice es el precio final que paga el cliente, no un monto ni un porcentaje, y no puede ser mayor que el precio: si bajas price por debajo del descuento guardado, envía también discountPrice. Si es menor que el precio, la tienda muestra el precio normal tachado. En las respuestas viene como discount. Enviar discountPrice deja un solo descuento, y null lo quita. En el administrador se pueden guardar varios descuentos seguidos: en ese caso discount es el primero, pero el cliente paga el último.

6. Los cambios no son instantáneos. La tienda se actualiza en segundo plano, y el menú elegido para cada cliente se guarda hasta 15 minutos, así que un cambio en las condiciones de un menú puede tardar ese tiempo en verse.

put/ecommerce/prices/{priceId}

Request

  • Base URL
    https://api.service.getjusto.com/v3
  • Auth
    none declared

Path parameters

priceIdstring required

ID Justo o ID externo del menú.

Request body

namestring

Nombre interno del menú.

prioritynumber

Prioridad. Si varios menús cumplen sus condiciones, aplica el de número más alto.

storesIdsstring[]

Locales donde puede aplicar. Vacío: todos los locales. Mientras no se sepa el local del cliente, un menú con locales no aplica.

channelsstring[]

Canales donde puede aplicar. Vacío: todos. Formato origen-tipo: web (tienda web), app (app propia de la marca), orion (app de Justo), commander y pos (punto de venta); delivery, go (retiro) o serve (mesa).

daysBeforenumber

Días de anticipación mínimos: sólo aplica si la hora de entrega menos el tiempo de preparación del local cae al menos esos días después de hoy. Debe incluir todos los productos que se pueden pedir con esa anticipación, también los de entrega el mismo día.

externalIdstring

ID externo configurado por la marca.

metadataobject

Metadata del item escrita por API v3.

scheduleobject

Horario en que aplica el menú (availableAtPeriods, openPeriods, closedDays, specialPeriods, timezone). Reemplaza el horario completo, así que envía todos sus campos. Sin timezone se usa America/Santiago. Las fechas se guardan tal como se envían: usa el inicio del día en esa zona horaria.

Response

The OpenAPI spec

successboolean

Example response

{
  "success": true
}

Changes

    • breaking

      request property / was restricted to a list of enum values

    • warning

      removed the request property

    • warning

      added the new app-delivery enum value to the // response property for the response status

    • warning

      added the new app-go enum value to the // response property for the response status

    • warning

      added the new app-serve enum value to the // response property for the response status

    • warning

      added the new commander-delivery enum value to the // response property for the response status

    • warning

      added the new commander-go enum value to the // response property for the response status

    • warning

      added the new commander-serve enum value to the // response property for the response status

    • warning

      added the new orion-delivery enum value to the // response property for the response status

    • warning

      added the new orion-go enum value to the // response property for the response status

    • warning

      added the new orion-serve enum value to the // response property for the response status

    • warning

      added the new pos-delivery enum value to the // response property for the response status

    • warning

      added the new pos-go enum value to the // response property for the response status

    • warning

      added the new pos-serve enum value to the // response property for the response status

    • warning

      added the new web-delivery enum value to the // response property for the response status

    • warning

      added the new web-go enum value to the // response property for the response status

    • warning

      added the new web-serve enum value to the // response property for the response status

    • info

      added the new app-delivery enum value to the request property /

    • info

      added the new app-go enum value to the request property /

    • info

      added the new app-serve enum value to the request property /

    • info

      added the new commander-delivery enum value to the request property /

    • info

      added the new commander-go enum value to the request property /

    • info

      added the new commander-serve enum value to the request property /

    • info

      added the new orion-delivery enum value to the request property /

    • info

      added the new orion-go enum value to the request property /

    • info

      added the new orion-serve enum value to the request property /

    • info

      added the new pos-delivery enum value to the request property /

    • info

      added the new pos-go enum value to the request property /

    • info

      added the new pos-serve enum value to the request property /

    • info

      added the new web-delivery enum value to the request property /

    • info

      added the new web-go enum value to the request property /

    • info

      added the new web-serve enum value to the request property /

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      endpoint added