Skip to main content

Production Timeline

This document covers the production timeline logic for Made-to-Order (MTO) products on the tracking page.

Timeline Selectionโ€‹

The system determines production timelines based on the _PRODUCTION_DAYS line item property:

const DEFAULT_PRODUCTION_DAYS = 56;

const getProductionDays = (shipment) => {
const lineItem = shipment.line_items.find((item) =>
item.properties?.some((property) => property.name === "_PRODUCTION_DAYS")
);
return Number(
lineItem?.properties?.find((property) => property.name === "_PRODUCTION_DAYS")?.value
) || DEFAULT_PRODUCTION_DAYS;
};

If no _PRODUCTION_DAYS property is found, the system defaults to 56 days.

Predefined Timeline Configurationsโ€‹

For specific _PRODUCTION_DAYS values, hardcoded timelines are used:

Production DaysStart (days)Reminder (days)End (days)Total to Production Complete
4910111031 days
56 (default)13131339 days

Custom Timeline Calculationโ€‹

For _PRODUCTION_DAYS values without a predefined configuration, the system calculates milestones dynamically:

const AVERAGE_DELIVERY_DAYS = 11;

const calculateCustomTimeline = (productionDays, averageDeliveryDays) => {
const numOfTimelines = 3; // (start, reminder, end)
return Math.round((productionDays - averageDeliveryDays) / numOfTimelines);
};

Formula: Math.round((productionDays - 11) / 3)

Example calculated timelines:

Production DaysStart (days)Reminder (days)End (days)Total to Production Complete
213339 days
2866618 days
3588824 days
4210101030 days
6317171751 days
7020202060 days
7722222266 days
8424242472 days

Timeline Phasesโ€‹

Each timeline has three cumulative phases with day offsets:

Order Created (processed_at)
โ†“ + timeline.start days
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Production Starts
Message: "Your dress is in progress. โœ‚๏ธ Sit tight while our team works their magic"
โ†“ + timeline.reminder days
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Production Reminder
Message: "It's almost ready! Just putting on the finishing touches โœจ"
โ†“ + timeline.end days
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Production Complete
Message: "We're packing up your dress! We'll update you when it's in transit"
โ†“
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Fulfillment Created (optional secondary cycle)
โ†“ + fulfillmentTimeline.reminder days
โ†“ + fulfillmentTimeline.end days
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

Timeline Calculationโ€‹

// Base calculation
const calculateDate = (days) => days * 86400 * 1000; // days to milliseconds

// Get timeline based on _PRODUCTION_DAYS property
const productionDays = getProductionDays(shipment);
const timeline = productionTimeline[productionDays.toString()]
? productionTimeline[productionDays.toString()]
: {
start: calculateCustomTimeline(productionDays, AVERAGE_DELIVERY_DAYS),
reminder: calculateCustomTimeline(productionDays, AVERAGE_DELIVERY_DAYS),
end: calculateCustomTimeline(productionDays, AVERAGE_DELIVERY_DAYS),
};

// Production cycle
const productionStartDate = new Date(orderCreated.getTime() + calculateDate(timeline.start));
const productionReminderDate = new Date(productionStartDate.getTime() + calculateDate(timeline.reminder));
const productionEndDate = new Date(productionReminderDate.getTime() + calculateDate(timeline.end));

// Fulfillment cycle (if order is fulfilled)
const fulfillmentStartDate = new Date(fulfillment.created_at);
const fulfillmentReminderDate = new Date(fulfillmentStartDate.getTime() + calculateDate(fulfillmentTimeline.reminder));
const fulfillmentEndDate = new Date(fulfillmentReminderDate.getTime() + calculateDate(fulfillmentTimeline.end));

"In Production" Status Rulesโ€‹

Status shows "In Production" only when:

  1. Current date is past production start date, AND
  2. No real carrier scan exists yet (no InTransit checkpoint)

Business Context: Prevents showing "In Production" before work actually begins, and automatically advances to "In Transit" once carrier scans the package.

Production Status Messagesโ€‹

Progressive Messagingโ€‹

For "In Production" status, display messages based on timeline progress:

const messages = {
start: "Your dress is in progress. โœ‚๏ธ Sit tight while our team works their magic",
reminder: "It's almost ready! Just putting on the finishing touches โœจ",
end: "We're packing up your dress! We'll update you when it's in transit"
};

// Show start message if past production start date
if (now > productionStartDate) {
show messages.start
}

// Show reminder message if past reminder date
if (now > productionReminderDate) {
show messages.reminder
}

// Show end message if past production end date
if (now > productionEndDate) {
show messages.end
}

Business Context: Sets customer expectations during production phase without overwhelming them with technical fulfillment details. Creates transparency and reduces "where is my order?" inquiries.

Theme Repositoryโ€‹

  • assets/tracking--order.js - Web Component with timeline logic
  • assets/tracking--get-shipment-status.js - Status determination including production state
  • snippets/global--store-variables.liquid - Timeline configurations