Skip to main content

Future Pricing and Promotions

Introduction

This feature allows ONIX ingestion to handle scheduled price changes and promotional periods. The system processes temporal pricing data and automatically determines base prices, promotional discounts, and price continuity logic for complex pricing scenarios.

Core Behavior

Complete Price Replacement

When ONIX data is processed for a product:

  • All existing prices for that product are deleted
  • Only prices specified in the ONIX feed are created
  • Currencies not mentioned in ONIX are completely removed from the product
  • This ensures ONIX serves as the authoritative pricing source

Base Price Inference

The system infers base prices from existing database context when calculating promotions:

  • When promotional prices are identified, the system looks for existing base price data
  • If pre-existing prices exist in the database, those amounts are used as base price references
  • Base price context is preserved across ONIX updates for accurate discount calculations
  • If no existing context exists, prices without temporal constraints become base prices

Price Continuity Logic

When gaps exist between pricing periods, the system creates continuity prices:

  • Uses the last known base price to fill gaps between existing and future prices
  • Ensures products always have available pricing without manual intervention
  • Maintains promotional relationships across price transitions

Minimum Price Validation

Medusa enforces a configurable minimum allowed price for every currency. During ONIX ingestion the following rules are applied:

  • If all prices supplied for a product in the ONIX message are below the minimum price threshold, the entire message is rejected for that product. None of the submitted prices are stored and the product remains unavailable for purchase.
  • If at least one submitted price meets or exceeds the minimum threshold, the ONIX payload is accepted. Medusa stores all supplied prices—including those that are below the minimum—and the product becomes available for sale using the exact values provided.

ONIX Processing Scenarios

1. Scheduled Prices with Start Dates Only

When ONIX data contains prices with future start dates but no end dates, the system creates prices that will activate at the specified times and remain active indefinitely.

'prices' => [
[
'amount' => 7.99,
'currency' => 'USD',
'starts_at' => '2025-06-01 00:00:00',
],
[
'amount' => 6.99,
'currency' => 'EUR',
'starts_at' => '2025-06-02 00:00:00',
],
]

Timeline Behavior:

  • Before June 1, 2025: No USD pricing available, product cannot be purchased in USD
  • Before June 2, 2025: No EUR pricing available, product cannot be purchased in EUR
  • From June 1, 2025 00:00:00: Shows $7.99 USD as base price (no discount)
  • From June 2, 2025 00:00:00: Shows €6.99 EUR as base price (no discount)
  • After start dates: Prices remain active indefinitely since no end dates are specified

2. Scheduled Prices with Both Start and End Dates

When ONIX data includes prices with both start and end dates, the system identifies this as a promotional period, allowing promotional prices.

'prices' => [
[
'amount' => 12.99,
'currency' => 'EUR',
'ends_at' => '2025-06-01 23:59:59',
],
[
'amount' => 8.99,
'currency' => 'EUR',
'starts_at' => '2025-06-02 00:00:00',
'ends_at' => '2025-06-05 23:59:59',
],
[
'amount' => 7.99,
'currency' => 'EUR',
'starts_at' => '2025-06-06 00:00:00',
],
]

Timeline Behavior:

  • Until June 1, 2025 23:59:59: Shows €12.99 EUR as base price
  • From June 2 to June 5, 2025: Shows €8.99 EUR as base price
  • From June 6, 2025 00:00:00: Shows €7.99 EUR as base price (no end date)

3. Complete Price Replacement

When new ONIX data is processed, the system first checks if the base price in the new ONIX data is defined. If it is not defined, the system retains the current base price from the pre-existing data. Otherwise, it replaces all existing prices for that product with the new pricing information, ensuring the authoritative nature of ONIX data is maintained.

4. Future Price Only Scenario

When ONIX data contains only future-dated prices and there is no current pricing defined in Farfalla, the product becomes temporarily unavailable for purchase until the scheduled price becomes active.

'prices' => [
// $19 price starting from June 1, 2025 (no current price)
[
'amount' => 19.00,
'currency' => 'USD',
'starts_at' => '2025-06-01 00:00:00',
],
]

Timeline Behavior:

  • Before May 31, 2025 23:59:59: No pricing available, product cannot be purchased
  • At May 31, 2025 23:59:59: Still no pricing available (price hasn't started yet)
  • From June 1, 2025 00:00:00: Shows $19.00 as base price (no discount)
  • After June 1, 2025: Price remains active indefinitely (no end date)

5. Price with End Date Only

ONIX data may specify prices that are active immediately but expire on a specific date, after which the product becomes unavailable for purchase.

'prices' => [
// $19 base price valid until June 30, 2025 (no start date, expires)
[
'amount' => 19.00,
'currency' => 'USD',
'ends_at' => '2025-06-30 23:59:59',
],
]

Timeline Behavior:

  • Until June 30, 2025 23:59:59: Shows $19.00 as base price
  • At June 30, 2025 23:59:59: Shows $19.00 (last second of availability)
  • From July 1, 2025 00:00:00: No pricing available, product cannot be purchased

6. Permanent Base Price (No Dates)

When ONIX data contains prices without any temporal constraints (no start or end dates), these become permanent base prices that remain active indefinitely.

'prices' => [
// Single permanent base price with no date restrictions
[
'amount' => 15.99,
'currency' => 'USD',
// No starts_at and no ends_at = permanent base price
],
]

Timeline Behavior:

  • Current time: Shows $15.99 as permanent base price (no discount)
  • Always: Price remains active across all time periods with no expiration

7. Base Price Inference with Existing Context

When ONIX data arrives with promotional prices that have temporal constraints, the system infers base prices from existing database context to maintain accurate discount calculations.

Pre-existing Database State:

  • $10.00 base price with $8.00 promotional discount until July 31, 2025

ONIX Update:

'prices' => [
// $8 price until July 31, 2025 (no start date, has end date)
[
'amount' => 8.00,
'currency' => 'USD',
'ends_at' => '2025-07-31 23:59:59',
],
// $10 price from August 1, 2025 onwards (has start date, no end date)
[
'amount' => 10.00,
'currency' => 'USD',
'starts_at' => '2025-08-01 00:00:00',
],
]

Timeline Behavior:

  • June 15, 2025: Shows $10.00 base with $8.00 promotional discount (20% off)
  • July 30, 2025: Shows $10.00 base with $8.00 promotional discount (20% off)
  • August 15, 2025: Shows $10.00 base price with no discount

8. Continuity Price Creation for Future-Only Prices

When ONIX data contains only future-dated prices and there are existing prices in the database, the system automatically creates continuity prices to bridge the gap and prevent purchasing interruptions.

Pre-existing Database State:

  • $15.00 permanent base price (no start/end dates)

ONIX Update:

'prices' => [
// Future price starts September 1, 2025 (gap from current to August 31)
[
'amount' => 12.00,
'currency' => 'USD',
'starts_at' => '2025-09-01 00:00:00',
],
]

Timeline Behavior:

  • May 15, 2025: Shows $15.00 continuity price (maintained from existing base)
  • August 15, 2025: Shows $15.00 continuity price (bridging the gap)
  • September 15, 2025: Shows $12.00 ONIX future price (no discount)

9. Gap Bridging with Existing Discounted Prices

When existing promotional prices expire before new ONIX prices take effect, the system creates continuity pricing based on the existing base price to maintain product availability during the gap period.

Pre-existing Database State:

  • $15.00 base price with $12.00 discount until June 30, 2025

ONIX Update:

'prices' => [
// Future price starts September 1, 2025 (gap from July 1 - August 31)
[
'amount' => 18.00,
'currency' => 'USD',
'starts_at' => '2025-09-01 00:00:00',
],
]

Timeline Behavior:

  • May 15, 2025: Shows $15.00 base with $12.00 discount (pre-existing promotion)
  • August 15, 2025: Shows $15.00 continuity base price (no discount, gap filled)
  • September 15, 2025: Shows $18.00 ONIX future price (no discount)
X

Graph View