Fulfillment – Daily Changelog – October 9, 2025

space burrito

Changelog – October 9, 2025

Known Issues

Fixed Batch 498 – 6 Orders Stuck Without Tracking

  • Problem: 6 orders in batch 498 (#5370, #5376, #5380, #5381, #5387, #5397) got stuck during bulk ShippingEasy sync
  • Root Cause: Bulk sync process got overwhelmed and left these orders in partial state – they had ShippingEasy IDs but no tracking numbers synced
  • Solution: Manually pulled tracking numbers from ShippingEasy and updated database directly
  • Result: All 6 orders now have tracking numbers and are marked as “shipped” – ready for Shopify sync

Critical Performance Fixes

Fixed Shipments API Performance Issue

  • Problem: Shipments API was using extremely inefficient nested subqueries with multiple COALESCE statements, causing database performance issues and app slowdowns
  • Root Cause: Query had 8+ nested subqueries running the same JOINs repeatedly for each shipment
  • Solution: Rewrote query using CTE (Common Table Expression) to perform JOINs once and reuse results
  • Performance Impact: Reduced query complexity from O(n²) to O(n) – should eliminate database bottlenecks
  • Files Updated: src/app/api/shipments/route.ts
  • Result: Shipments API should now load quickly without bogging down the database

New Features

Mixed Order Batch Creation Logic

  • Problem: Orders containing both fulfillable and ignored products (like VIP tickets + bike entries) were incorrectly creating mixed batches that included ignored items
  • Solution: Implemented proper mixed order handling:
  • Added isExternallyFulfilled() function to identify ignored products (VIP tickets, etc.)
  • Updated batch creation logic to filter out ignored products when determining batch type
  • Batch type now based only on fulfillable items (print, stock, raffle stickers)
  • Orders with ignored items get production notes explaining excluded items
  • Example: Order with 2 VIP tickets + 1 bike entry now creates a raffle_stickers batch (not mixed) with note about ignored tickets
  • Files Updated:
  • src/lib/product-type-utils.ts – Added isExternallyFulfilled() function
  • src/app/api/batches/route.ts – Updated batch creation logic and order note system
  • Result: System now processes only what we actually fulfill while maintaining visibility of ignored items

Technical Details

Batch Creation Logic Enhancement

  • Standard Batch Types: Print, Stock, Mixed, Raffle Stickers
  • Special Case – Partial Fulfillment Orders:
  • If order contains ignored products + fulfillable products
  • Create batch based only on fulfillable items
  • Flag order with note indicating ignored items
  • Do NOT include ignored items in fulfillment expectations
  • Do NOT classify entire order as requiring ignored items

Implementation Notes

  • Uses is_externally_fulfilled product flag and requires_shipping = false variant flag
  • Maintains backward compatibility with existing batch creation
  • Adds production notes to orders for transparency
  • Prevents batch creation if no fulfillable items exist